This is a migrated thread and some comments may be shown as answers.

IOS Whitelisting

2 Answers 61 Views
Apple iOS
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ken
Top achievements
Rank 1
Ken asked on 23 Mar 2017, 05:04 PM

I have recently needed to update an app that uses .ajax to call a webservice as in the example below.

This was working perfectly when using cordova pre version 4 but this version is no longer available as a build option

I'm assuming this is a "whitelist" issue but am struggling to find where and how I define this address

Can anyone give any guidance on what needs updating?

Many Thanks

Ken

 

 $.ajax({
        url: "http://webservices.etiamfrs.co.uk/service.asmx/GetProjects",
        data: "{'db':'omega','Supplier':'Omega Signs'}",
       contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: true,
        crossDomain: true,
        type: "POST",
        async: false,
        success: function (json) {
         jsonArray = $.parseJSON(json.d);
         for(i=0; i < jsonArray.length; i++)
         {
             project = jsonArray[i].installation;
             var content = '<option value="' + project +'">' + project + '</option>';
             $("#selectedProject").append(content);
         }
           
        },
        error: function (data) {
            $('#div_error').html(data.responseText);
            alert("Error loading Projects " + data.responseText);
        }
    });   

2 Answers, 1 is accepted

Sort by
0
Ken
Top achievements
Rank 1
answered on 28 Mar 2017, 08:56 AM

Just a quick update in case anyone else has these issues I was able to bypass the security issue by adding the keys below to the plist.info file.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key> <true/>
</dict>

 

Not the best from a security point of view but at least we are up and running again.

 

 

0
Martin
Telerik team
answered on 28 Mar 2017, 10:10 AM

Hi Ken,

I see that you have already found a solution. Indeed iOS have introduced with iOS 9 App Transport Security with which if the application attempts to connect to make HTTP request (instead of HTTPS), the connection will fail.

One way to solve this, as you mentioned, is to disable the App Transport Security by adding the following to your project info.plist

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
 
You may also Configure App Transport Security exceptions as shown in this article.
 
Regards,
Martin
Telerik by Progress
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Apple iOS
Asked by
Ken
Top achievements
Rank 1
Answers by
Ken
Top achievements
Rank 1
Martin
Telerik team
Share this question
or