Friday, June 1, 2012

NSURLCredential(To by Pass the local proxy)

 
 
 NSURLCredentialStorage * credentialStorage=[NSURLCredentialStorage sharedCredentialStorage]; 
    NSURLCredential * newCredential;
    newCredential=[NSURLCredential credentialWithUser:@"username" password:@"password" persistence:NSURLCredentialPersistencePermanent];
    NSURLProtectionSpace * mySpaceHTTP=[[NSURLProtectionSpace alloc] initWithProxyHost:@"proxy_setting" port:8080 type:NSURLProtectionSpaceHTTPProxy realm:nil authenticationMethod:nil];
    NSURLProtectionSpace * mySpaceHTTPS=[[NSURLProtectionSpace alloc] initWithProxyHost:@"proxy_setting" port:8080 type:NSURLProtectionSpaceHTTPSProxy realm:nil authenticationMethod:nil];
    [credentialStorage setCredential:newCredential forProtectionSpace:mySpaceHTTP];
    [credentialStorage setCredential:newCredential forProtectionSpace:mySpaceHTTPS];

No comments:

Post a Comment