1
votes

i am developing a Instagram-like App with ionic and with iOS9 i am getting a strange error, i looked for a solution in the web but i didnt find something helpful. The strange thing is, the Filters at the bottom of the screen are using the same image, but there it is working.

and GapDebug is throwing this error:

Failed unsafe:file:///var/mobile/Containers/Data/Application/AC45E204-30FB-4F61-92DF-97B840149D7D/tmp/cdv_photo_002.jpg to load resource: unsupported URL

Screenshot from the App

Solution: add this to your .config in app.js

$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|file|mailto|chrome-extension):/);

3

3 Answers

1
votes

If you're getting this error on an img src then this might be the whitelist config you're looking for: $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|content|file|assets-library):|data:image\//);

0
votes

You are likely not using a version number, which is forcing you to use white-lists. Set your Cordova compiler version to before 4.0.0, like maybe 3.7.1 _OR_ setup, the white-list, the white-list plugin, and the CSP (see bottom of docs)

0
votes

Try adding the following to the <head> of your index.html:

    <meta http-equiv="Content-Security-Policy" content="
    default-src 'self' data: gap: *;
    script-src 'self' 'unsafe-inline' 'unsafe-eval' *;
    style-src 'self' 'unsafe-inline' 'unsafe-eval' *;
    media-src 'self' 'unsafe-inline' 'unsafe-eval' *;
    img-src 'self' 'unsafe-inline' 'unsafe-eval' * data:;">