I've updated a project from Cordova 3.4 to 3.6.3 and everything has fallen apart (as usual).
But specifically, here, the org.apache.cordova.dialogs
plugin is not working in runtime on ios.
Cordova says the plugin is installed:
$ cordova plugins ls
org.apache.cordova.dialogs 0.2.9 "Notification"
org.apache.cordova.vibration 0.3.10 "Vibration"
In config.xml (the one outside of the platforms directory) I have added:
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>
When, in JavaScript, I try to create an alert like this (and yes device is ready):
navigator.notification.alert("Test alert", null);
I get this error thrown in the XCode debugger (I added line breaks for legibility)
2014-09-18 15:03:26.327 Milk[3045:60b]
CDVPlugin class CDVNotification (pluginName: Notification) does not exist.
2014-09-18 15:03:26.328 Milk[3045:60b]
ERROR: Plugin 'Notification' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-09-18 15:03:26.329 Milk[3045:60b]
-[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
"INVALID",
"Notification",
"alert",
[
"Test alert",
"Alert",
"OK"
]
]
I have tried cordova plugin rm
/ cordova plugin add
and also running cordova platform rm
to add and remove ios.
So: "CDVPlugin class CDVNotification (pluginName: Notification) does not exist."?
Cordova says it's installed, how can I solve this?
Here is what I did in order to fix this issue.
In Xcode, you have to add the plugin sources in the build phases.
You can give it a try easily by updating via
sudo npm update -g cordova
and reverting with your commands if it does not work. Let me know.Also if you have still some errors after that, make sure you included all the frameworks required:
In the same tab (Build phases), you have Link Binary With Libraries (xx items)
for the contact plugin you need:
AddressBook.framework
AddressBookUI.framework
for the camera plugin you need:
OpenAL.framewrok
ImageIO.framework
for the notification plugin you need:
AudioToolBox.framewrok
for the device plugin you need:
AssetsLibrary.framework
Cheers
I globally downgraded to Cordova 3.5 and now it seems OK.
@icl1c Your answer didn't quite work for me, got another error after adding CDVNotification.m to the build phase.
What I had to do was to add the dependent framework: AudioToolbox.framework as well to make it work.
@jBoive answer plus adding below code in config.xml, fixed my issue: