插件' PushPlugin'没找到Cordova 3.5

时间:2014-06-11 10:54:49

标签: ios cordova push-notification phonegap-pushplugin

我正在关注this教程,将推送通知应用到我的PhoneGap应用程序中。但是我在XCode中一直收到以下错误:

2014-06-03 22:50:38.425 Clubbed In[336:60b] CDVPlugin class PushPlugin (pluginName: PushPlugin) does not exist.
2014-06-03 22:50:38.425 Clubbed In[336:60b] ERROR: Plugin 'PushPlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-06-03 22:50:38.427 Clubbed In[336:60b] -[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
"PushPlugin1224815266",
"PushPlugin",
"register",
[
 {
  "alert" : "true",
  "ecb" : "onNotificationAPN",
  "sound" : "true",
  "badge" : "true"
 }
]

我已将4个委托/插件文件成功放入项目的插件文件夹中。另外,我添加了PushNotification.js并正确引用它。我的config.xml中还有以下功能标记:

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

有谁知道为什么我会收到此错误?我很确定我正确地手动安装了这个PushPlugin。

在plugins文件夹中,我应该包含一个名为com.plugin.PushPlugin的文件夹,然后将4个文件放在其中吗?

真正感谢任何帮助。我长期以来一直坚持这个问题......

谢谢!

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,但我找到了解决方案。我用以下内容替换了我的初始代码:

var pushNotification = PushNotification.init({
        "android": {
            "senderID": "1234567890"
        },
        "ios": {"alert": "true", "badge": "true", "sound": "true"}, 
        "windows": {} 
    });

    pushNotification.on('registration', function(data) {
        console.log("registration event");
        console.log(JSON.stringify(data));
    });

    pushNotification.on('notification', function(data) {
        console.log("notification event");
        console.log(JSON.stringify(data));

        pushNotification.finish(function () {
            console.log('finish successfully called');
        });
    });

    pushNotification.on('error', function(e) {
        console.log("push error");
    });

PushPlugin not found, or is not a CDVPlugin