Reputation: 2229
I have built a hybrid app with ionic framework. I have used angular imgcache (https://github.com/jBenes/angular-imgcache.js/tree/master) to allow caching of images fetched from an external site.
I am using code such as:
<img img-cache ic-src="{{src}}"/>
It works a treat in browser (after using 'ionic serve') on command line. I have tested it in ionic view iOS app. I have now take the xcodeproj that it creates and distributed it for testing but the images do not load.
I have even added the cordova whitelist plugin and set metas to allow CORS requests.
Does anybody have any other ideas what the issue could be?
Upvotes: 6
Views: 1831
Reputation: 1728
If you are not accessing an HTTPS endpoint, you might benefit from checking that your App Transport Security settings in the .plist file (found in platforms/ios/{app_name}/{app_name}-Info.plist)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$
<plist version="1.0">
<dict>
...
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
From this resource: Publishing an Ionic Angular App for iOS - The Hidden Steps & Pitfalls .
Upvotes: 0
Reputation: 735
First, make sure you set the img cache to manual init ImgCacheProvider.manualInit = true;
in your app.config
function.
Second step - call ImgCache.$init()
anytime after deviceready event (in your case, somewhere in the $ionicPlatform.ready
function).
Upvotes: 3