简体   繁体   English

notification.confirm回调不触发phonegap iOS

[英]notification.confirm callback not firing phonegap iOS

I'm using Phonegap (Cordova) v1.9, and this app is solely for iPhone4+ use. 我正在使用Phonegap(Cordova)v1.9,并且此应用仅用于iPhone4 +。

I've tried the two methods below, on their own and simultaneously. 我已经分别尝试了以下两种方法。

Phonegap's deviceready event has been fired previous to this code. 此代码之前已触发Phonegap的deviceready事件。

I'm using the iPhone configuration utility to watch the console, but I'm not getting anything from the code below. 我正在使用iPhone配置实用程序来观看控制台,但是我没有从下面的代码中得到任何东西。

Also, I'm using Sencha Touch (v1.1) and jQuery. 另外,我正在使用Sencha Touch(v1.1)和jQuery。 No conflicts noticed throughout the app. 在整个应用程序中没有发现冲突。

Please help? 请帮忙?

function onConfirmCallback(button){
    console.log("onConfirmCallback");
    console.log(button);
}

var toConfirm = navigator.notification.confirm("You don't have a pincode set.\nWould you like to set one now?", onConfirmCallback, "Pincode", "Yes,No");
toConfirm.onAlertDismissed = function(index, label){
    console.log("onAlertDismissed");
    console.log(index);
}

Have you tried looking for exceptions to see what might be happening? 您是否尝试过寻找异常情况以查看可能发生的情况?

try
{
    var toConfirm = navigator.notification.confirm("You don't have a pincode set.\nWould you like to set one now?", onConfirmCallback, "Pincode", "Yes,No");
    toConfirm.onAlertDismissed = function(index, label) {
        console.log("onAlertDismissed");
        console.log(index);
    }
}
catch (ex)
{
    console.log(ex.message);
}

Edit: 编辑:

The example mentioned in the comment below (from https://groups.google.com/group/phonegap/browse_thread/thread/126f56f4e296e555 ) is for PhoneGap 0.9.2. 下方评论中的示例(来自https://groups.google.com/group/phonegap/browse_thread/thread/126f56f4e296e555 )适用于PhoneGap 0.9.2。 I have not seen any examples for v1.3 where the confirm function returns an object as your using with 'toConfirm'. 我还没有看到v1.3的任何示例,在这些示例中,confirm函数返回一个与'toConfirm'一起使用的对象。 Maybe that is causing your problem. 可能是造成您的问题。 Have you tried the following (removing all other code to do with toConfirm to simplify the problem)? 您是否尝试过以下方法(删除所有其他与toConfirm代码以简化问题)?

navigator.notification.confirm("You don't have a pincode set.\nWould you like to set one now?", onConfirmCallback, "Pincode", "Yes,No");

http://docs.phonegap.com/en/1.3.0/phonegap_notification_notification.md.html#notification.confirm http://docs.phonegap.com/en/1.3.0/phonegap_notification_notification.md.html#notification.confirm

Also, is there any reason your not using a newer version of PhoneGap (Cordova)? 另外,您是否有任何理由不使用较新版本的PhoneGap(Cordova)?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM