简体   繁体   中英

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.

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.

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. 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并且它的工作正常...如果加载速度太慢,那么很高兴知道模拟器错误

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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