I want to login by using web service.
My website is https based. I am using following tutorial.
http://agilewarrior.wordpress.com/2012/02/01/how-to-
This is an issue with the website you're connecting to, not the code. If it does not have a known certificate, it will be treated as a security risk.
What's happening is that your certificate is not valid (in the point of view of your app). If you want to take the risk, you can add the following code.
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
NSArray * trustedHosts = @[@"your domain"];
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
if ([trustedHosts containsObject:challenge.protectionSpace.host])
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
So the certificate will be ignored. (remember to replace "your domain", with your domain.)