Instance Method インスタンスメソッド

URLSession:task:didReceiveChallenge:completionHandler:

Requests credentials from the delegate in response to an authentication request from the remote server. リモートサーバからの認証リクエストに応じて、委任先に資格情報を要請します。

Declaration 宣言

- (void)URLSession:(NSURLSession *)session 
              task:(NSURLSessionTask *)task 
didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge 
 completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler;

Parameters パラメータ

session

The session containing the task whose request requires authentication. それのリクエストが認証を要請するタスクを含んでいるセッション。

task

The task whose request requires authentication. それのリクエストが認証を要請するタスク。

challenge

An object that contains the request for authentication. 認証に対する要請を含んでいるオブジェクト。

completionHandler

A handler that your delegate method must call. Its parameters are: あなたの委任先メソッドが呼び出す必要があるハンドラ。それのパラメータは:

  • disposition—One of several constants that describes how the challenge should be handled. disposition— いくつかの定数のうちの1つ、それはどのようにチャレンジが取り扱われるべきかを記述します。

  • credential—The credential that should be used for authentication if disposition is NSURLSessionAuthChallengeUseCredential; otherwise, NULL. credential — 資格情報、それは認証に使われるべきです、もし意向がNSURLSessionAuthChallengeUseCredentialであるならば;そうでなければ、NULL

Discussion 議論

This method handles task-level authentication challenges. The NSURLSessionDelegate protocol also provides a session-level authentication delegate method. The method called depends on the type of authentication challenge: このメソッドは、タスク水準認証チャレンジを取り扱います。NSURLSessionDelegateプロトコルはまた、セッション水準認証委任先メソッドを提供します。呼び出されるメソッドは、認証チャレンジの型に依存します:

See Also 参照

Handling Authentication Challenges 認証チャレンジを取り扱う