For the last 7 months I'm involved in iPhone development.
Currently I'm writing a software for an Online Estate Agent. The software I'm writing uses RESTful Web Services extensively. The application is in a stage we would like to show to our customer. So we exposed our RESTful Web Services over our corporate firewall using HTTPS.
Our dev server is iphone.example.org, we have a valid certificate for *.example.org, but it's being rejected by the iPhone.
The solution for this problem was pretty simple (but it can be used only in dev!). All I had to do was create a new category of
NSURLRequest and implement static private
allowsAnyHTTPSCertificateForHost:host method. The complete source code looked like this:
@implementation NSURLRequest (AllowsAnyHTTPSCertificate)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host {
return YES;
}
@end
Hope it saves some of you time :)
cheers,
Łukasz