According the PhoneGap documentation, I can write a JavaScript proof-of-concept like this:
window.plugins.barcodeScanner.scan(
function(result) {
if (result.cancelled)
alert("the user cancelled the scan")
else
alert("we got a barcode: " + result.text)
},
function(error) {
alert("scanning failed: " + error)
}
)
But it then begins to talk about an XCode project.
Q: Do I need to write an XCode app in order to use the barcodescanner feature of PhoneGap?
Yes, you will need to setup XCode. PhoneGap is a framework you can use to build cross platform mobile apps. The JavaScript API is the same across all platforms but each app must be build by the native tool like XCode or Eclipse.
There is a service called PhoneGap Build that you can upload your code to in order for the app to be built in the cloud but I don’t think it supports the BarcodeScanner yet.