Cordova 应用程序在 iOS 10 上启动时挂起 [英] Cordova app hanging during startup on iOS 10
问题描述
我刚刚安装了 Xcode 8 beta,以便在 iOS 10 beta(通过模拟器)中测试我现有的 Cordova 应用程序.当应用程序启动时,它只是挂在加载页面上 - 似乎没有触发 deviceready
事件.
I just installed Xcode 8 beta in order to test my existing Cordova app in iOS 10 beta (via Simulator). When the app is launched, it just hangs on the loading page - seems the deviceready
event is not being fired.
所以我还在我的 iPad Air 上安装了 iOS 10 测试版(以防万一它是模拟器问题),但我得到了相同的结果.
So I also installed iOS 10 beta on my iPad Air (just in case it's a Simulator issue), but I get the same results.
该应用在 iOS 9.3(设备和模拟器)上运行良好.
The app works fine on iOS 9.3 (both device and Simulator).
有人遇到/解决过这个问题吗?
Anyone encountered/fixed this problem?
更新
此问题的其他症状包括:
Other symptoms of this problem include:
- 如果您将应用程序置于后台(切换回主屏幕)然后将应用程序置于前台(切换回应用程序),应用程序将正确启动
- 在您进行上述切换之前,某些插件将无法正常工作
推荐答案
好的,感谢 这篇文章:
iOS 10 似乎需要 Content-Security-Policy
元标记中的其他条目,即 gap:
和 file:
.添加这些后,我的Content-Security-Policy
看起来像这样:
It seems that iOS 10 requires additional entries in the Content-Security-Policy
meta tag, namely gap:
and file:
. After adding these, my Content-Security-Policy
looks like this:
<meta http-equiv="Content-Security-Policy" content="default-src * gap: file:; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src * 'unsafe-inline' 'unsafe-eval'">
该应用程序在 iOS 10 上启动并正常运行.
And the app starts up and works fine on iOS 10.
希望这对其他人有帮助.
Hope this helps others.
这篇关于Cordova 应用程序在 iOS 10 上启动时挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!