2013-12-23 25 views
0

我正在嘗試使用PushPlugin開發iOS應用程序。我對着下面的錯誤:在使用科爾多瓦的iOS應用程序中未找到PushPlugin

DEPRECATION NOTICE: The Connection ReachableViaWWAN return value of '2g' is deprecated as of Cordova version 2.6.0 and will be changed to 'cellular' in a future release. 

2013-12-23 17:19:52.362 myApp[537:60b] CDVPlugin class PushPlugin (pluginName: PushPlugin) does not exist. 

2013-12-23 17:19:52.363 miniOrangeAuthenticator[537:60b] ERROR: Plugin 'PushPlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml. 

2013-12-23 17:19:52.364 miniOrangeAuthenticator[537:60b] -[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [ 

    "PushPlugin1458195152", 

    "PushPlugin", 

    "register", 

    [ 

    { 

     "alert" : "true", 

     "ecb" : "onNotificationAPN", 

     "sound" : "true", 

     "badge" : "true" 

    } 

    ] 

] 

我已經加入config.xml文件的依賴性如下:

<feature> 
    <param name="ios-package" value="PushPlugin" /> 
</feature> 

我也嘗試用下面的代碼舊的插件格式:

<plugin name="PushPlugin" value="com.phonegap.plugins.PushPlugin" /> 

即使這給了我同樣的錯誤。

我想在一個真正的iOS設備上。

這裏可能是什麼問題?

回答

0

您使用的是哪個版本的cordova? 我用cordova 2.9安裝了該插件,我記得我在導入xcode中的文件時遇到了一些問題。 如果您在iOS上使用cordova 3.x,您只需通過命令行添加插件(在android上,您也可以手動複製文件,但在iOS上不需要)。

編輯回答評論中的問題:我能想到的唯一的事情就是在「設備就緒」事件被觸發之前初始化插件。這是我使用的代碼:

var initPushNotification = function() { 
    var pushNotification = window.plugins.pushNotification; 
    pushNotification.register(
     tokenHandler, 
     errorHandler, { 
      "badge":"true", 
      "sound":"true", 
      "alert":"true", 
      "ecb":"onNotificationAPN" 
     }); 
}; 

function onDeviceReady() { 
    // other stuff here... 
    initPushNotification(); 
} 
+0

這個插件是通過命令行添加的。儘管tokenHandler沒有被調用。任何想法爲什麼? –

1

我試過this tutorial for android。我認爲這會對你有幫助。你也可以試試這個enter link description here

+0

我試過Holly Schinsky的教程,雖然它似乎不適合我。一直只遵循這一點。我只是做了一個改變,就是將插件名稱替換爲「com.adobe.plugins.pushplugin」 –

+0

我在android中使用GCM完成了它。嘗試另一個鏈接,下載該示例將適用於Android。 –

+0

我的應用程序正在使用Android。我試圖讓它在iOS上工作 –

相關問題