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.
我用离子框架构建了一个混合应用程序。我使用了角度imgcache(https://github.com/jBenes/angular-imgcache.js/tree/master)来允许缓存从外部站点获取的图像。
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.
它在命令行中在浏览器中使用(在使用'离子服务'之后)。我在离子视图iOS应用程序中测试过它。我现在已经使用它创建的xcodeproj并将其分发用于测试,但图像不会加载。
I have even added the cordova whitelist plugin and set metas to allow CORS requests.
我甚至添加了cordova白名单插件并设置metas以允许CORS请求。
Does anybody have any other ideas what the issue could be?
有没有人有任何其他想法可能是什么问题?
2 个解决方案
#1
3
First, make sure you set the img cache to manual init ImgCacheProvider.manualInit = true;
in your app.config
function.
首先,确保在app.config函数中将img缓存设置为手动初始化ImgCacheProvider.manualInit = true;
Second step - call ImgCache.$init()
anytime after deviceready event (in your case, somewhere in the $ionicPlatform.ready
function).
第二步 - 在deviceready事件之后的任何时候调用ImgCache。$ init()(在你的情况下,在$ ionicPlatform.ready函数中的某个地方)。
#2
0
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)
如果您没有访问HTTPS端点,则可以通过检查.plist文件中的App Transport Security设置(可在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 .
从这个资源:发布iOS的离子角度应用程序 - 隐藏的步骤和陷阱。
#1
3
First, make sure you set the img cache to manual init ImgCacheProvider.manualInit = true;
in your app.config
function.
首先,确保在app.config函数中将img缓存设置为手动初始化ImgCacheProvider.manualInit = true;
Second step - call ImgCache.$init()
anytime after deviceready event (in your case, somewhere in the $ionicPlatform.ready
function).
第二步 - 在deviceready事件之后的任何时候调用ImgCache。$ init()(在你的情况下,在$ ionicPlatform.ready函数中的某个地方)。
#2
0
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)
如果您没有访问HTTPS端点,则可以通过检查.plist文件中的App Transport Security设置(可在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 .
从这个资源:发布iOS的离子角度应用程序 - 隐藏的步骤和陷阱。