While testing a Phonegap app on an iOS device with the BarcodeScanner plugin, I encountered the following error:
ERROR: Plugin 'BarcodeScanner' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
I could not find any solutions that worked for me online, so I had to experiment and here’s what I found to work for me.
After creating the Phonegap app, downloading the plugin and using your own code or this demo:
cordova.define("com.phonegap.plugins.barcodescanner.BarcodeScanner", function(require, exports, module) {
/* barcodescanner.js goes here */
});
src="js/barcodescanner.js"
phonegap build ios
Let me know if this works for you or if you found other solutions. Curiously, building the app more than once in terminal makes this not work :/
Comments
I had the same symptom, but a different cause: The file CDVBarcodeScanner.mm was not set to compile in XCode. I don’t know how that happened, but for the benefit of anyone else coming here via Google, here is the link to the solution:
http://stackoverflow.com/a/21148428/1713762
by Jens Neubauer