Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova 5.3.1 and iOS9 platform - I can't load images and scripts form external sources

Primarily I was trying to get connection through Socket.io but soon figured out that nothing from "outside" can be loaded into my Cordova/iOS app. I checked the whitelist settings in config.xml. They seemed to be fine but just in case I added

Unfortunately that didn't help. I tried to remove the whitelist plugin

cordova plugin add org.apache.cordova.whitelist

Plugin "cordova-plugin-whitelis" is not present in the project. See cordova plugin list.

So I checked cordova plugin list and that returned

cordova-plugin-console 1.0.1 "Console"
cordova-plugin-dialogs 1.1.1 "Notification"
cordova-plugin-vibration 1.2.0 "Vibration"
cordova-plugin-whitelist 1.1.0 "Whitelist"

I guess the one above may be some sort of default one?

My next try was removing the following meta tag from index.html

<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *">

But that didn't help either...

like image 740
Adam Bubela Avatar asked Feb 10 '23 00:02

Adam Bubela


1 Answers

After many hours of struggling with the Cordova settings I'm still unsure what Whitelist I have installed and what is the best way of setting it up but one thing that certainly helped me was inserting into Info.plist (may be something like HelloWorld-Info.plist)

the following tags

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

After that I can connect through web-socket or load external images!

I hope this will help some time the others.

like image 101
Adam Bubela Avatar answered Mar 02 '23 01:03

Adam Bubela