[SOLVED] NSURLConnection/CFURLConnection HTTP load failed

This has to do with SSL untrusted certificates that we are using for development purposes. What we are going to do is to make our app works with it.

Caution: Delete this fix for real environments

  • On your project’s folder go to:
    /platforms/ios/

  • Open: projectname.xcodeproj

  • On the source tree that you will see on the left go to:
    CordovaLib.xcodeproj/Classes/Commands/

  • Open: CDVWebViewDelegate.m

Edit it and add just above @implementation CDVWebViewDelegate the following: (perhaps you need to grant privileges)

@implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host{
    return YES;
}
@end
  • Then clean, build and test again the emulator / device app you are using.
    Menu: product / clean and then the “play” button with the simulator we want or our device.

That’s all. Hope it’s useful.

Edited:
This is only a transitory solution for avoiding headaches. Once we build the app again, this is lost and we need to edit it again.