Windows phone 8 Windows Phone 8 PhoneGap条形码扫描仪

Windows phone 8 Windows Phone 8 PhoneGap条形码扫描仪,windows-phone-8,phonegap-plugins,barcode-scanner,Windows Phone 8,Phonegap Plugins,Barcode Scanner,我一直在尝试将WindowsPhone8与PhoneGap和用于条形码扫描的插件()一起使用。但我不知道如何开始 我在index.html中集成了一个,但VS2012只告诉我错误:“无法获取未定义或空引用文件的属性'barcodeScanner':x-wmapp0:www/index.html行:31” 有人能帮我一下吗?我想你没有包括cordova.windows-x.x.x.js或barcodescanner.js。barcodescanner.js中有一个bug 在文件的底部写着 Cord

我一直在尝试将WindowsPhone8与PhoneGap和用于条形码扫描的插件()一起使用。但我不知道如何开始

我在index.html中集成了一个
,但VS2012只告诉我
错误:“无法获取未定义或空引用文件的属性'barcodeScanner':x-wmapp0:www/index.html行:31”


有人能帮我一下吗?

我想你没有包括cordova.windows-x.x.x.js或barcodescanner.js。

barcodescanner.js中有一个bug

在文件的底部写着

Cordova.addConstructor(function() {
将Cordova更改为Cordova(小写),您就可以开始了

下一步,如果您得到错误

Error::Plugin not allowed in config.xml. org.apache.cordova.barcodeScanner
尝试扫描时,将以下内容添加到项目根目录中的config.xml中:

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

我不确定这是否是您想要的,但这是我为使其工作所做的步骤:

在项目中添加条形码扫描仪和ZXingVer1_7 dll

将BarcodeScanner.cs添加到项目中。(必须位于项目的根目录下)

添加到config.xml

将barcodescanner.js添加到您的“www”目录

添加
在cordova.js声明后返回html页面。(路径可能会有所不同,具体取决于您放置html的位置)

在barcodescanner.js中,确保所有“cordova”引用不是这样写的:“cordova”

在barcodescanner.js中,在以“return cordova.exec(…”开头的行中,将字符串“barcodescanner”替换为“(您的项目名称).barcodescanner”

要使用它,只需将其添加到需要条形码扫描的位置:

window.plugins.barcodeScanner.scan(function (result) {
        alert("We got a barcode\n" +
                  "Result: " + result.text + "\n" +
                  "Format: " + result.format + "\n" +
                  "Cancelled: " + result.cancelled);
          }, function (error) {
            alert("Scanning failed: " + error);
        });