iOS notification.alert()不能使用Phonegap 2.3.0

当尝试在Xcode 4.6中使用Phonegap 2.3.0使用navigator.notification.alert()时,我遇到了一个奇怪的问题。

我有两个文件,index.html和other.html。 点击index.html中的“testing警报”会触发警报,但是在closures警报并导航到other.html后,单击“testing其他警报”不会触发警报。

但是,如果您在移至other.html之前点击index.html上的两次或更多次“testing警报”,警报将继续按预期运行。 只有在触发警报ONCE和更改页面后警报才会一起运行。

的index.html

<!DOCTYPE html> <html> <head> <script type="text/javascript" src="cordova-2.3.0.js"></script> <script type="text/javascript" charset="utf-8"> function alertTest() { navigator.notification.alert('Testing', null, 'Alert Test', 'OK'); } </script> </head> <body> <a href='other.html'>Move to other page</a> <a href="#" onclick="alertTest(); return false;">Test the alert</a> </body> </html> 

other.html

 <!DOCTYPE html> <html> <head> <script type="text/javascript" src="cordova-2.3.0.js"></script> <script type="text/javascript" charset="utf-8"> function alertTest() { navigator.notification.alert('Testing', null, 'Alert Test', 'OK'); } </script> </head> <body> <a href="index.html">Go back</a> <a href="#" onclick="alertTest(); return false;">Test the alert</a> </body> </html> 

我完全丧失了为什么发生这种情况,因为在我的应用程序中,我需要能够触发不同页面button上的警报,这在这个例子中似乎是碰碰运气。

任何帮助或在正确的方向微调非常感谢!

更新:

这似乎只发生在iOS 6和6.1模拟器。 当警报没有popup时,按主页键,然后再次打开应用程序会使缺less的警报一次显示。

此示例也具有相同的行为: http : //docs.phonegap.com/en/2.3.0/cordova_notification_notification.md.html#Notification

任何人都可以确认,如果这只是最新的Xcode模拟器错误?

这个问题存在,因为Phonegap 2.2也看到: PhoneGap for iOS中的通知 Phonegap 2.3上的Windows Mobile上的同样的问题。

我没有从2.1更新…似乎是它正常工作的最后一个版本。

不要忘记添加document.addEventlistener("deviceready", onDeviceReady, true); 以上。

更新到最新版本的phonegap(2.4.0)。 似乎解决了这个问题。 至less对我来说现在一切正常。