Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)connection:(NSURLConnection *)connectionParam didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
- if([challenge previousFailureCount] == 0) {
- NSURLCredential *newCredential=[NSURLCredential credentialWithUser:@"your username" password:@"your password" persistence:NSURLCredentialPersistenceNone];
- [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge];
- } else {
- [[challenge sender] cancelAuthenticationChallenge:challenge];
- NSError* error = [NSError errorWithDomain:@"RequestResultHandler" code:403 userInfo: [NSDictionary dictionaryWithObjectsAndKeys: @"Could not authenticate this request", NSLocalizedDescriptionKey,nil]];
- [self handleError:error];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement