我将按照本教程在我的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个delegate/plugin文件放入我的项目的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,或者不是CDVPlugin