0

我試圖在windows phone 7上實現條形碼掃描器插件。根據插件的自述文件執行以下步驟:
1.將dll添加到我的項目。
2.將barcodescanner.js添加到'www'文件夾,並將js文件包含在我的'index.html'中。
3.將BarcodeScanner.cs添加到我的項目中。Windows Phone 7上的條形碼掃描器phonegap/cordova插件

我沒有找到任何指導在windows phone平臺上實現這一點,所以我嘗試使用this指南,這是爲Android編寫使用插件的html/js。我已經inlcuded一個按鈕的onclick其所稱的「掃描()」函數:

function Scan() { 
window.plugins.barcodeScanner.scan(
    function(result) { 
    alert("Scanned Code: " + result.text 
      + ". Format: " + result.format 
      + ". Cancelled: " + result.cancelled); 
}, function(error) { 
    alert("Scan failed: " + error); 
}); 
} 

在運行應用程序,並單擊該按鈕時,我發現了以下錯誤在控制檯窗口:

Error:"Unable to get value of the property 'barcodeScanner': object is null or undefined file:x-wmapp1:/app/www/index.html Line:45"

我如何得到這個工作?

回答

0

這是一個與Phonegap 2.7相關的問題。 它工作,不知何故,當我在2.9.0上嘗試它。

0

您是否在config.xml中添加了 <plugin name="org.apache.cordova.barcodeScanner">