iOS notification.alert()不能使用Phonegap 2.3.0 [英] iOS notification.alert() not working using Phonegap 2.3.0

查看:153
本文介绍了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.

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

This example also has the same behaviour: http://docs.phonegap.com/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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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