IOS Whitelisting

3 posts, 0 answers
  1. Ken
    Ken avatar
    6 posts
    Member since:
    Sep 2013

    Posted 23 Mar Link to this post

    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. Ken
    Ken avatar
    6 posts
    Member since:
    Sep 2013

    Posted 28 Mar Link to this post

    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.

     

     

  3. Martin
    Admin
    Martin avatar
    103 posts

    Posted 28 Mar Link to this post

    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.

     
Back to Top