Created
September 2, 2011 01:21
-
-
Save daijo/1187733 to your computer and use it in GitHub Desktop.
Add basic auth credential for a NSURLConnection.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURLCredentialStorage *sharedCredentials = [NSURLCredentialStorage sharedCredentialStorage]; | |
NSURLCredential *credential = [NSURLCredential credentialWithUser:@"user" password:@"pwd" persistence:NSURLCredentialPersistencePermanent]; | |
NSURLProtectionSpace *protectionSpace = [[[NSURLProtectionSpace alloc] initWithHost:@"my.gtdify.com" port:80 protocol:@"http" realm:nil authenticationMethod:NSURLAuthenticationMethodHTTPBasic] autorelease]; | |
[sharedCredentials setCredential:credential forProtectionSpace:protectionSpace]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment