0

我正在按照教程在我的 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。

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

任何帮助将不胜感激。我被这个问题困扰了很长时间......

谢谢!

4

1 回答 1

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 未找到,或者不是 CDVPlugin

于 2016-02-20T15:48:10.493 回答