Objective-c – ignoring Https SSL exception on iphone


I have a self signed SSL certificate serving out my test enviroment. I would like to do some testing connecting to the service from my iphone however, the SSL exception is causing an error.

Is there a way to ignore the SSL exception on the iPhone?


I should have added a bit more detail, the answers below will work hoever if i can get it to work inside NSXMLParser that would be even better.

Best Solution

If you're only testing, you can use the private setAllowsAnyHTTPSCertificate:forHost: method on NSURLRequest. Otherwise, I'd recommend using the ASIHTTPRequest library which provides a great high-level API to the CFNetwork APIs, including the ability to use self-signed certificates. The method you're looking for is setValidatesSecureCertificate:.