HTTP basic authentication (NSURLAuthenticationMethodHTTPBasic) requires a user name and password. Prompt the user for the necessary information and create an NSURLCredential object with credentialWithUser:password:persistence:.
After you’ve created the NSURLCredential object:
- For NSURLSession, pass the object to the authentication challenge’s sender using the provided completion handler block.
- For NSURLConnection and NSURLDownload, pass the object to the authentication challenge’s sender with useCredential:forAuthenticationChallenge:.
Maybe this helps.