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

Can no longer load http images from Cloudinary on iOS after upgrading to Cordova 4.0.0

2 Answers 66 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Artie
Top achievements
Rank 1
Artie asked on 09 Mar 2016, 02:45 PM

Our application serves up images from Cloudinary, the URLs for which are stored in a database.  All of these images point to http://res.cloudinary.com.  We recently upgraded our project to Cordova 4.0.0 in order to be prepared for the Play Store changes as well as try to resolve some issues for which we do not yet have root causes.

One unexpected problem we ran into is that on iOS, the application no longer honored any requests to http:// URLs.  We were loading in a Google font which we easily fixed with an https:// prefix, but the Cloudinary images are a bit more troublesome as the URLs have all been stored in the database with an http:// prefix (we have thousands of these).  Our config.xml file has had this line in since the beginning of this project:

<access origin="*" />

This setting apparently has any effect on this issue.  After doing some research I wondered if perhaps I could address this issue with a Content Security Policy meta header, but this created all kinds of other issues including some problems within the Kendo framework itself trying to load some kind of internal XSLT file.  Something else that doesn't make much sense is that it looks like the 4.0.0 version of Cordova as displayed in AppBuilder is version 3.8.0 for iOS, and on version 3.8.0 the application works just fine.  I am wondering if anyone can point me in the right direction.  Re-writing the Cloudinary URLs dynamically is not an ideal solution, as the version of our app deployed in the wild is still saving and serving up the http:// version of these URLs.

2 Answers, 1 is accepted

Sort by
0
Artie
Top achievements
Rank 1
answered on 09 Mar 2016, 03:14 PM

A friend of mine with experience on native iOS apps pointed me here:

http://stackoverflow.com/questions/30751053/ios9-ats-what-about-html5-based-apps

Adding this to my Info.plist file allowed the images to load correctly:

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

I still don't fully understand why this broke when going from Cordova 3.8.0 to 4.0.0 (iOS 3.8.0?), when deployed to the exact same device but this is at least how I managed to solve the issue.

0
Accepted
Kaloyan
Telerik team
answered on 14 Mar 2016, 08:46 AM
Hello Artie,

I am happy to see that you have found a solution to the issue.

The reason why the problem occurs in the Cordova 4.0 set and not in the Cordova 3.8 set in AppBuilder is that, the Cordova 3.8 set uses iOS SDK 8.4 and Cordova 4.0 - iOS SDK 9. This and the fact that Apple applied their policy about HTTP traffic in iOS 9, the limitation is not present for Cordova 3.7 and 3.8 in AppBuilder.

I hope this helps.

Regards,
Kaloyan
Telerik
 

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

 
Tags
Apache Cordova
Asked by
Artie
Top achievements
Rank 1
Answers by
Artie
Top achievements
Rank 1
Kaloyan
Telerik team
Share this question
or