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

编程入门 行业动态 更新时间:2024-10-13 14:24:28
本文介绍了iOS notification.alert()不能使用Phonegap 2.3.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个奇怪的问题,当试图使用navigator.notification.alert()在Xcode 4.6使用Phonegap 2.3.0。

I have a strange issue when attempting to use navigator.notification.alert() in Xcode 4.6 using Phonegap 2.3.0.

我有两个文件,索引。 html和other.html。从index.html点击测试提醒会按预期触发提醒,但在关闭提醒后导航到other.html,点击测试其他提醒不会触发提醒。

I have two files, index.html and other.html. Clicking 'Test the alert' from index.html triggers the alert as expected, however after dismissing the alert and then navigating to other.html, clicking 'Test the other alert' does not trigger the alert.

但是,如果您在转到其他.html之前在index.html上单击测试警报两次或更多次,警报将继续按预期工作。只有在触发警报ONCE和更改页面后,警报才会一起停止运行。

However, if you click 'Test the alert' two or more times on index.html before moving to the other.html, the alert will continue to function as expected. It's only after triggering the alert ONCE and changing pages that the alerts stop functioning all together.

index.html

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

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>

我完全失去了为什么会发生这种情况,因为在我的应用程序我需要在不同的页面上触发按钮按下的警报,这在此示例中看起来很难受。

I am at a complete loss as to why this happens, as in my app I need to be able to trigger alerts on button presses on different pages, which is seemingly hit-and-miss in this example.

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

Any help or nudge in the right direction is greatly appreciated!!

更新:

这似乎只适用于iOS 6和6.1模拟器。当警报没有弹出时,按下主页键,然后再次打开应用程序,使缺失的警报一次显示。

This seems to only happen with iOS 6 and 6.1 simulators. When alerts don't pop up, pressing the home key and then opening the app again makes the missing alerts appear all at once.

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

This example also has the same behaviour: docs.phonegap/en/2.3.0/cordova_notification_notification.md.html#Notification

任何人都可以确认这是否是最新Xcode中的模拟器错误?

Can anyone confirm if this is just a simulator bug in the latest Xcode?

推荐答案

这个问题存在,因为Phonegap 2.2也看到: PhoneGap for iOS中的通知 WindowsMo​​bile在Phonegap 2.3上的相同问题。

This problem exists since Phonegap 2.2 also see: Notification in PhoneGap for iOS Same problem on WindowsMobile on Phonegap 2.3.

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

I didn't update from 2.1 ... seems to be the last version where it worked properly.

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

更多推荐

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

本文发布于:2023-11-27 19:56:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639390.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:notification   iOS   alert   Phonegap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!