NSURLCredential *credential2 = [NSURLCredential
credentialForTrust:challenge.protectionSpace.serverTrust
credentialWithUser: @"username"
password: @"password"
persistence:NSURLCredentialPersistenceNone];
[challenge.sender useCredential:credential2 forAuthenticationChallenge:challenge];
I need to bypass a self signed certificate with a UIWebView while also being able to pass in a username and a password for authentication.
NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
and
NSURLCredential *credential = [NSURLCredential credentialWithUser: @"username" password: @"password" persistence:NSURLCredentialPersistenceNone];
are both valid alone both they fuss when I try to combine them... Any ideas?
Used RestKit and the code below along with an alertView for login credentials to solve this issue.
The login alertView adds the text for username and password to userdefaults and passes the retained URL back into the initWithURL function. The login alertview is being called when a page isn't authenticated (with login credentials).