Instance Method

getCredentialsForProtectionSpace:task:completionHandler:

Gets a dictionary containing the credentials for the specified protection space, on behalf of the given task, and passes the dictionary to the provided completion handler.

Declaration

- (void)getCredentialsForProtectionSpace:(NSURLProtectionSpace *)protectionSpace task:(NSURLSessionTask *)task completionHandler:(void (^)(NSDictionary<NSString *,NSURLCredential *> *credentials))completionHandler;

Parameters

protectionSpace

The protection space whose credentials you want to retrieve.

task

The task accessing the specified protection space.

completionHandler

A completion handler that receives a single argument with the credentials for the specified protection space and task. The dictionary’s keys are user name strings, and the corresponding value is a NSURLCredential. If no credential has been set for this space, the argument to the completion handler is nil.

See Also

Retrieving Credentials

allCredentials

The credentials for all available protection spaces.

- credentialsForProtectionSpace:

Returns a dictionary containing the credentials for the specified protection space.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software