Phonegap在iOS上没有调用deviceReady

Lee*_*lla 2 jquery ios cordova

我有一个运行在机器人设备上的功能完善的phonegap应用程序.但是,当我将事情移交给iOS时,该deviceReady方法永远不会触发.

HTML HEADER

<head>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi' name='viewport' />
<meta charset='utf-8' />
<link href='stylesheets/application.css' rel='stylesheet' />
<link href='http://code.jquery.com/mobile/1.0rc2/jquery.mobile.structure-1.0rc2.min.css' rel='stylesheet' />
<link href='stylesheets/application.css' rel='stylesheet' />
<script src='http://code.jquery.com/jquery-1.6.4.min.js'></script>
<script src='http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js'></script>
<script src='javascripts/application.js'></script>
<script src='javascripts/phonegap-1.2.0.js'></script>
</head>
Run Code Online (Sandbox Code Playgroud)

的application.js

$(function() {
  document.addEventListener("deviceready", function(){alert(2)}, false);
});
Run Code Online (Sandbox Code Playgroud)

如果我在$(function(){})其中发出警报功能,那么我知道jquery和application.js已经加载了.一个alert()在phonegap.js也火灾,确认已还加载.

Dev*_*eks 10

您是否在iOS应用中使用Android应用中的phonegap-1.2.0.js?换句话说,你也复制了吗?

PhoneGap拥有每个平台的phonegap-1.x.js文件.确保您使用的是iOS?

  • 这为我修好了,浪费了2天.在我看来,该文件应该被命名为平台. (3认同)
  • 但iOS的phonegap.js在哪里?它不在phonegap文件夹中的lib/iOs文件中. (2认同)