I am developing an app using Cordova, Angular and Ionic. I have a problem with the phonegap push plugin and I've searched a lot but no solutions found.
I use cordova 5.4.1 and phonegap-plugin-push 1.5.3. When I run the app on iPad or emulator from Xcode, logs throws this error:
ERROR: Plugin 'PushPlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
[CDVCommandQueue executePending] [Line 159] FAILED pluginJSON = [
"PushPlugin938856013",
"PushPlugin",
"register",
[{
"ecb":"onNotificationAPN",
"alert":"true",
"badge":"true",
"sound":"true"
}]
]
I've reinstalled the plugin several times, removing/ adding the ios platform, and nothing works. I`ve also tried adding on config.xml lines like:
<feature name="PushPlugin">
<param name="ios-package" value="PushPlugin" />
</feature>
But doesn't work.
I've read for including PushPlugin.m in build phases on Xcode and PushPlugin.h in plugin forlder too, but both alredy in. I can see how Xcode is compiling the plugin (and generating some warnings ), everything seems normal, but for some reason it can't be included on the app.
Like I've said, I've wasted a lot of time searching and trying solutions, but nothing works.. Could anybody help me, please?
https://github.com/phonegap-build/PushPlugin#description
Important - Push notifications are intended for real devices. They are not tested for WP8 Emulator. The registration process will fail on the iOS simulator.
But I guess for what its worth, try cordova plugin add phonegap-plugin-push --save
as phonegap/phonegap-plugin-push
is the new unified version
I'm happy to say that, after two weeks, I've found the solution! When I thought I'm getting crazy, the plugin finally works! I was initializing the plugin by the wrong (and old) way. I replaced my init code with:
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");
});
And it works! Many thanks for you help, @Dwardu!
来源:https://stackoverflow.com/questions/35430445/pushplugin-not-found-or-is-not-a-cdvplugin