Based on your comments that you are getting a invalid cert error and that you are using NSURLConnection your solution is to implement these delegate. See if this solves the problem.
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]
forAuthenticationChallenge:challenge];
}
Note that you are essentially ignore the SSL error and allowing the connection to proceed. So if you are opening up the app for hacking. For testing you can use this but make sure that you install a proper certificate on the production environment.
But if you want to handle this correctly and warn the user in case the cert is not proper you can do this.
OSStatus err = noErr;
BOOL trusted = NO;
NSURLProtectionSpace * protectionSpace = challenge.protectionSpace;
SecTrustRef serverTrustRef = protectionSpace.serverTrust;
SecTrustResultType trustResult;
//check if the server trust that we got from the server can be trusted by default
err = SecTrustEvaluate(serverTrustRef, &trustResult);
trusted = (err == noErr) && ((trustResult == kSecTrustResultProceed) || (trustResult == kSecTrustResultUnspecified));
if (trusted) //if the site is trusted then continue with that trust
{
[challenge.sender useCredential:[NSURLCredential credentialForTrust:protectionSpace.serverTrust]
forAuthenticationChallenge:challenge];
}
else //if not then warn the user about this and let the user make a decision
{
//warn the user about the cert problem using a dialog with options to continue or ignore.
//Continue alert action call : [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]
forAuthenticationChallenge:challenge];
//Dont continue action: [challenge.sender continueWithoutCredentialForAuthenticationChallenge:_challenge];
//OR call: [sender cancelAuthenticationChallenge:challenge];
}
}