For the More Curious: Credentials
When you try to access a web service, it will sometimes respond with an authentication challenge, which means “Who the heck are you?” You then need to send a username and password (a credential) before the server will send its genuine response.
There are objects that represent these ideas. When the challenge is received, your connection delegate is sent a message that includes an instance of NSURLAuthenticationChallenge. The sender of that challenge conforms to the NSURLAuthenticationChallengeSender protocol. If you want to continue to get the data, you send back an instance of NSURLCredential, which typically looks something like this:
- (void)connection:(NSURLConnection *)conn ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access