PhoneGap的(不科尔多瓦)3.5的示例应用程序不触发deviceready [英] Phonegap (NOT Cordova) 3.5 sample app not firing deviceready

查看:146
本文介绍了PhoneGap的(不科尔多瓦)3.5的示例应用程序不触发deviceready的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我注意到:sudo的NPM更新-g的PhoneGap表明V3.5是可用的。做此更新后,PhoneGap的-v回报:3.5.0-0.20.4

I noticed today that: sudo npm update -g phonegap showed that v3.5 was available. After doing this update, phonegap -v returns: 3.5.0-0.20.4

我然后就创建使用PhoneGap的CLI一个示例应用程序:

I then proceeded to create a sample app using the Phonegap CLI:


  • CD myProjectFolder的

  • PhoneGap的创建HelloPhoneGap350

  • CD HelloPhoneGap350

  • 的PhoneGap本地构建IOS(添加iOS平台)

  • PhoneGap的运行IOS --emulator

在这一点上,示例应用程序启动。然而,deviceready事件不会被调用。 (我加了一些警惕code和可以看到app.initialize()和app.bindEvents()被调用。但onDeviceReady从来没有被调用。我也能够有一个Android版本重现此。

At this point, the sample app launches. However, deviceready event never gets called. (I added some alert code and can see that the app.initialize() and app.bindEvents() get called. But onDeviceReady never gets called. I was also able to reproduce this with an Android build.

几个星期前,我通过恰与PhoneGap的(v3.4.0-0.20.0)的previous版本相同的过程去创造一个HelloWorld340它工作正常,并不会调用的函数onDeviceReady

A few weeks ago, I went through exactly the same process with the previous version of Phonegap (v3.4.0-0.20.0) to create a HelloWorld340 which works fine and does call the onDeviceReady function.

我意识到的PhoneGap 3.5.0包装科尔多瓦3.5.0的只出过几天。也许是在包装中的错误?任何人有任何意见或解决方案。

I realize that the Phonegap 3.5.0 packaging of cordova 3.5.0 has only been out a few days. Perhaps it's a bug in the packaging? Anyone have any ideas or solutions.

谢谢!

推荐答案

在过去的几天里更多有趣的观察。我经历的过程去创造几个项目。 (我迁移到新的PhoneGap 3.5一帮老的PhoneGap应用程序和更容易创建新的,样本项目,只是移动现有的HTML / JS / CSS code在...)

More interesting observations over the past few days. I went through the process to create a few more projects. (I'm migrating a bunch of old PhoneGap apps to the new PhoneGap 3.5 and it's easier to create new, sample projects and just move the existing HTML/JS/CSS code over...)

在这项工作中,我注意到 - 与一些具体的步骤 - 生成的项目可以发射deviceready开箱即用。下面是详细信息:

During this work, I noticed that - with a few specific steps - the generated project can fire "deviceready" out of the box. Here are the details:


  • 我注意到phonegap.js文件似乎将获得在正确的地方时,在命令行中创建的应用程序(命名为yourprojectname /平台/ IOS / WWW / phonegap.js)。

然而,在第一次推出以X code的项目,它似乎并不即使它在X $ C $℃以内切入/ www的观点被察觉。但是,如果下面的过程中,以x code重建似乎注意到它的存在和打包权位推送到设备/仿真器。

However, upon first launch of the project with Xcode, it doesn't seem to be noticed even though it's in the "Staging/www" view within Xcode. However, if you following procedure, the rebuild in Xcode seems to notice that it's there and package up the right bits to push to the device/emulator.


  • CLI:PhoneGap的地方共建的ios

  • X code:产品 - 清洁​​< - 这似乎是重要的一步

  • X code:产品 - 建立/运行

(注意,但是,出现在最初创建的平台/ IOS / WWW的cordova.js文件不会被删除,因此,你最终用不同的名称相同的文件2份:科尔多瓦。 JS和phonegap.js)

(Note, however, that the cordova.js file that appears in the initial creation of platforms/ios/www doesn't get removed. So, you end up with 2 copies of the same file with different names: cordova.js and phonegap.js)

通过这种方法,你不必编辑生成的index.html溶液(如在此线程另一种解决方案/解决方法中提到)。

With this approach, you don't have to edit the generated index.html solution (mentioned as another solution/workaround in this thread).

这篇关于PhoneGap的(不科尔多瓦)3.5的示例应用程序不触发deviceready的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆