gpt4 book ai didi

javascript - PhoneGap for iOS 中的通知

转载 作者:行者123 更新时间:2023-11-29 11:04:04 24 4
gpt4 key购买 nike

我需要在 PhoneGap 2.2.0 for iOS 中使用通知。

我添加到 PhoneGap.plist -> 插件 ->com.phonegap.notification(也尝试只通知)但它不起作用。

这里是 PhoneGap 文档:<强> PhoneGap Notification

iOS 无法识别通知

这里是我在通知中的使用:

   navigator.notification.confirm(
'EXIT?', // message
onConfirm, // callback to invoke with index of button pressed
'Good-Bay', // title
'Cancle,OK' // buttonLabels
);

我错过了什么?

最佳答案

Apache Cordova 文档说,你需要添加App/Supporting Files/Cordova.plist

中的以下行
<key>Plugins</key>
<dict>
<key>Notification</key>
<string>CDVNotification</string>
</dict>

并在此处找到示例代码

<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>

<script type="text/javascript" charset="utf-8" src="cordova-2.1.0.js"></script>
<script type="text/javascript" charset="utf-8">

function onConfirm(buttonIndex) {
alert('You selected button ' + buttonIndex);
}

function showConfirm() {
navigator.notification.confirm(
'EXIT?',
onConfirm,
'Good-Bay',
'Cancle,OK'
);
}

</script>
</head>
<body>
<p><a href="#" onclick="showConfirm(); return false;">Show Confirm</a></p>
</body>
</html>

我认为这对您有帮助。

关于javascript - PhoneGap for iOS 中的通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14437061/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com