2013-01-21 41 views
1

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

我添加到PhoneGap.plist - > plugin - > com.phonegap.notification(也嘗試只是通知),它不工作。

這裏的PhoneGap文件: ​​

iOS的不承認通知

這裏我通知用途:

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

我錯過?

+0

是你在iframe中這樣做? – SHANK

+0

xcode ........... –

+0

我想我可以假設你不在iframe中工作。 – SHANK

回答

0

我不知道在2.2版本的問題,

我下載了最新版本的PhoneGap的(2.3.0)和它的工作..

1

Apache Cordova的文件說,你需要在應用程序添加 以下線/支持文件/ 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> 

我認爲這對你有幫助。

+0

我沒有App/Supporting Files/Cordova.plist –

+0

我不知道該把插件放在哪裏..我只有白名單:App/Supporting Files/PhoneGap.plist - >它不是一個xml文件 –

1

試試這個,

function onConfirm() 
{} 
    navigator.notification.alert(
    'EXIT?',     // message 
    onConfirm,    // callback to invoke with index of button pressed 
    'Good-Bay',   // title 
    'OK'     // button 
); 
+0

I hava function onConfirm –