我正在按照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个委托/插件文件成功放入项目的plugin文件夹中。另外,我添加了PushNotification.js并正确引用了它。我的config.xml中还有以下功能标签:

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


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

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

任何帮助将不胜感激。我已经在这个问题上停留了很长时间了...

谢谢!

最佳答案

我遇到了同样的问题,但我只是找到了解决方案。我已将初始化代码替换为:

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

关于ios - 找不到插件“PushPlugin” Cordova 3.5,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24161130/

10-09 06:28