1

I have a HTTPS request in my app and I am doing that way:-

NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

For Authentication, I have implemented the following methods

-(BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
 {
   return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
 }

-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
 {
   if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
      {
        if ([challenge.protectionSpace.host isEqualToString:[[NGHelper sharedInstance] getBaseURL]])
           {
        [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
           }
       }

[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}

But now i want to use [NSURLConnection sendAsynchronousRequest:theRequest queue:bqueue completionHandler:^(NSURLResponse* response, NSData* data,NSError* error){}];

Please guide me how can I implement Authentication methods using oprationqueue.

Toseef Khilji
  • 17,192
  • 12
  • 80
  • 121
  • 2
    you can not handle authentication this way when using sendAsynchronousRequest because you can not set a delegate – Felix Dec 26 '13 at 11:13
  • phix23: it means this is kind of limitation working with operationqueue for NSURLConnection ?? – iosDeveloper Dec 26 '13 at 11:18

0 Answers0