Instance Method

getDefaultCredential(for:task:completionHandler:)

Gets the default credential for the specified protection space, which is being accessed by the given task, and passes it to the provided completion handler.

Declaration

func getDefaultCredential(for space: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping (URLCredential?) -> Void)

Parameters

space

The protection space of interest.

task

The task seeking to use the protection space

completionHandler

A completion handler that receives the default credential as its argument, or nil if there is no default credential for this combination of protection space and task.

See Also

Getting and Setting Default Credentials

func defaultCredential(for: URLProtectionSpace) -> URLCredential?

Returns the default credential for the specified protection space.

func setDefaultCredential(URLCredential, for: URLProtectionSpace)

Sets the default credential for a specified protection space.

func setDefaultCredential(URLCredential, for: URLProtectionSpace, task: URLSessionTask)

Sets the default credential for a given protection space, which is being accessed by the given task.

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