0
votes

I wanted to use barcode scanning in my App and tried to use the BarcodeScanner BarcodeScanner plugin for PhoneGap (I build a project for iOS).

Since the explanations given are aiming on a previous version of PhoneGap, I have trouble to initialize the plugin. I think it has something to do with the plugin integration in the config.xml file.

Currently I have added the following line:

Beside that I did everthing mentioned in the plugin description.

When trying to scan a specific barcode with:

window.plugins.barcodeScanner.scan()

I receive the following error:

TypeError: 'undefined' is not an object (evaluating 'window.plugins.barcodeScanner')

Thanks for helping me out,

Christoph

1

1 Answers

1
votes

I had trouble until I replaced the line in my config with this

<plugin name="org.apache.cordova.barcodeScanner" value="CDVBarcodeScanner" />

and in the Classes/Commands/CDVPlugin.h file, changed these lines:

NSString* const CDVPageDidLoadNotification;
NSString* const CDVPluginHandleOpenURLNotification;
NSString* const CDVPluginResetNotification;
NSString* const CDVLocalNotification;

to this:

extern NSString* const CDVPageDidLoadNotification;
extern NSString* const CDVPluginHandleOpenURLNotification;
extern NSString* const CDVPluginResetNotification;
extern NSString* const CDVLocalNotification;