javascript 科尔多瓦 5 秒后设备就绪未触发

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32659113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 15:35:10  来源:igfitidea点击:

deviceready not fired after 5 seconds Cordova

javascriptandroidiossqlitecordova

提问by grane2212

I get this console message

我收到此控制台消息

deviceready has not fired after 5 seconds.

Channel not fired: onPluginsReady

Channel not fired: onCordovaReady

5 秒后 deviceready 未触发。

频道未触发:onPluginsReady

频道未触发:onCordovaReady

when I use the following ionic code snippet.

当我使用以下离子代码片段时。

ionic.Platform.ready(function(){
    // will execute when device is ready, or immediately if the device is already ready.
    // some code here. I am making calls to sqlite cordova plugin
});

The control never goes inside the ionic.Platform.readyfunction. Funny thing is that my code works on android devices but don't work on iOS devices.

控件永远不会进入ionic.Platform.ready函数。有趣的是,我的代码适用于 android 设备,但不适用于 iOS 设备。

I have tried doing a lot of stuff so far. I have tried following the troubleshooting given in this link. http://ngcordova.com/docs/common-issues/

到目前为止,我已经尝试了很多东西。我已尝试按照此链接中给出的故障排除进行操作。 http://ngcordova.com/docs/common-issues/

The following is my configuration

以下是我的配置

Cordova version 5.3.1

Ionic version 1.6.4

科尔多瓦版本 5.3.1

离子版本 1.6.4

回答by shashank

Try adding this if not already included..

如果尚未包含,请尝试添加它。

http-equiv="Content-Security-Policy"

To meta tag in your index.html file. It should look like..

在 index.html 文件中使用元标记。它应该看起来像..

<meta http-equiv="Content-Security-Policy".......>

回答by Shraavan Hebbar

I had same issue on iOS .Spent almost 3 to 4 days .Finally any of these two workarounds worked for me

我在 iOS 上遇到了同样的问题。花了将近 3 到 4 天。最后,这两种解决方法中的任何一种都对我有用

1.add < meta http-equiv="Content-Security-Policy".......> to index.html

1.在index.html中添加<meta http-equiv="Content-Security-Policy"......>

2.downgrade platform to 4.0.0 (cordova platform update [email protected]

2.降级平台到4.0.0(cordova平台更新[email protected]

回答by JesseMonroy650

@grane2212, You did not post any code, so it is difficult to debug this. Please post your index.html file, if this does not answer your question.

@grane2212,您没有发布任何代码,因此很难调试。如果这不能回答您的问题,请发布您的 index.html 文件。

You may be loading your javascript support file from a CDN or the web. DO NOT DO THIS.
Load all *.js files locally.

您可能正在从 CDN 或网络加载您的 javascript 支持文件。不要这样做。
在本地加载所有 *.js 文件。

Let me know, if this helps.

如果这有帮助,请告诉我。

回答by grane2212

window.cordova.plugins.Keyboardwas causing some issues as it is deprecated as of Cordova version 3.0. Now you need to use window.cordova.require()syntax to access the plugins.

window.cordova.plugins.Keyboard导致了一些问题,因为它从Cordova 3.0 版开始被弃用。现在您需要使用window.cordova.require()语法来访问插件。

Also removing and adding the ios platform helped.The package.json gets messed up sometimes.

删除和添加 ios 平台也有帮助。 package.json 有时会搞砸。