简体   繁体   English

准备好Cordova设备在xcode模拟器上不起作用,但在设备上工作

[英]Cordova device ready doesn't work on xcode simulator but work on device

don't know why but the device ready event doesn't work anymore on xcode simulator, but it's works on my iphone device. 不知道为什么但是设备就绪事件在xcode模拟器上不再起作用,但它可以在我的iphone设备上运行。

Here my function: 我的功能在这里:

document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {}

and the meta tag i have try but don't succeed: 我尝试但不成功的元标记:

    <meta http-equiv="Content-Security-Policy" content="default-src * gap: ws: https://ssl.gstatic.com;img-src 'self' data: content:;style-src 'self' 'unsafe-inline' data: blob:;script-src * 'unsafe-inline' 'unsafe-eval' data: blob:;">
   <meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src * 'unsafe-inline' 'unsafe-eval'">
   <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
  <meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src * 'unsafe-inline' 'unsafe-eval'">

it works also with the phonegap application on device. 它也适用于设备上的phonegap应用程序。

If anyone have an idea, if you need more explications tell me. 如果有人有想法,如果你需要更多的解释告诉我。

Excuse me for my english. 对不起我的英语。

Have you try removing all of your meta to exclude any other reasons? 您是否尝试删除所有元数据以排除任何其他原因? Your onDeviceReady don't seems to return anything. 您的onDeviceReady似乎没有返回任何内容。 How do you know it does not fired? 你怎么知道它没有解雇? Something like this could help tracking. 这样的事情可以帮助跟踪。

function onDeviceReady() {
console.log('deviceready fired');
}

好吧,我在vmware上使用mac os X而且它非常慢,我已经尝试使用其他更强大的PC并且它的工作正常...如果加载速度太慢,那么很高兴知道模拟器错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM