Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- iOS 5 - connect to an HTTPS server
- - (void)setCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)protectionSpace
- - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:
- (NSURLAuthenticationChallenge *)challenge {
- if ([challenge previousFailureCount] <= maxRetryCount ) {
- NSURLCredential *newCredential =
- [NSURLCredential
- credentialWithUser: userName
- password:password
- persistence:NSURLCredentialPersistenceForSession];
- [[challenge sender]
- useCredential:newCredential
- forAuthenticationChallenge:challenge];
- }
- else
- {
- NSLog(@"Failure count %d",[challenge previousFailureCount]);
- }
- }
Add Comment
Please, Sign In to add comment