Meteor.js Cordova Error: ERROR whitelist rejection

2019-04-29 16:07发布

问题:

When running a Meteor.js Cordova iOS app on the iPhone, some of the images in the app do not load and the XCode console shows the error

ERROR whitelist rejection: url='https://d2xngy2dw7hums.cloudfront.net.....

How can we add some/all domains to the whitelist?

回答1:

App.accessRule('*');  // add this to your mobile-config.js

You will need to kill and rebuild your meteor project

meteor run ios-device 

See related question for more details: In meteor app how to add orgin=* in cordova config.xml?



回答2:

From XCode, open the Resources folder and you'll find yourapp-Info.plist. Open the plist file then under the App Transport Security Settings dictionary, add a new boolean key, 'Allow Arbitrary Loads' (this should auto-fill as you type) and set value to 'YES'. Alternatively,still within the App Transport Security dictionary, there's another dictionary called Exception domains, they have localhost listed there, you can use that as a template to add other domains.