Terry Vail

Terry Vail

  • NA
  • 23
  • 731

Cordova iOS app AJAX POST to SSL fails

Apr 25 2018 4:31 PM
We’ve developed a Cordova app in Visual Studio 2017 which communicates with a WebAPI 2.0 RESTful service. The Android app successfully communicates with the server, but the Apple iOS app fails with an error code of 0. The server has a valid certificate and tests from https://www.ssllabs.com/ssltest/index.html show that TLS 1.2 is in place and will be used for Apple Transport Security. We have logging in the API and it appears that the Apple app does not enter the API at all. There is also nothing in the IIS logs showing that a POST was made to the server.
Here’s a code snippet…
  1. $.ajax({  
  2. type: "POST",  
  3. url: webService + "Login/",  
  4. contentType: "application/json; charset=utf-8",  
  5. data: JSON.stringify(loginViewModel),  
  6. dataType: "json",  
  7. crossdomain: true,  
  8. async: true,  
  9. headers: { 'X-Requested-With''XMLHttpRequest' }  
  10. })  
  11. .done(function (incomingUserData) {  
  12. // Load the user's home page  
  13. loadMainPage();  
  14. endBusy();  
  15. })  
  16. .fail(function (jqXHR, textStatus, errorThrown) {  
  17. // throw an error  
  18. });  
Any help is greatly appreciated.