0
        - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {

            return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
        }

       - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {

        NSLog(@"got auth challange");
        NSURLCredential *newCredential;
        newCredential=[NSURLCredential credentialWithUser:    (NSString*)@"company//A1234"    
password:(NSString*)@"apple@999"
persistence:NSURLCredentialPersistencePermanent];
   [[challenge  sender] useCredential:newCredential     forAuthenticationChallenge:challenge];

        NSLog(@"Auth error: %@",[[challenge  error] description]);
        NSLog(@"Failure count:%d",[challenge previousFailureCount]); 
        }
        //- (id)initWithProxyHost:(NSString *)host port:(NSInteger)port type:(NSString *)type realm:(NSString *)realm  authenticationMethod:(NSString *)authenticationMethod{
        //    
        //    return self;
        //}

I use this method to access a public url from proxy network, but its delegate didReceiveAuthenticationChallenge is not getting called

John Smith
  • 2,012
  • 1
  • 21
  • 33
kiran
  • 4,285
  • 7
  • 53
  • 98

1 Answers1

4
 - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {

        return YES;
    }

Then it will call!

kiran
  • 4,285
  • 7
  • 53
  • 98