Cordova Ajax Request failed on iOS because of invalid SSL certificate

When developing with Cordova for iOS, you often make Ajax requests to SSL-encrypted hosts, such as APIs.

Sometimes, these SSL certificates are not valid (or self signed), so iOS breaks the call and sends out an error message to the console in xcode.

To get around this error, we can tell iOS to simply ignore invalid certificates.

Open the file yourproject/platforms/ios/appname/Classes/AppDelegate.m  and insert the following code at the end:

Then run the app from xcode or cordova to check whether it is working now.

Verfasse einen Kommentar