PhoneGap的酒吧code扫描插件 - >引用错误 [英] phonegap barcode scanner plugin -> Reference Error
本文介绍了PhoneGap的酒吧code扫描插件 - >引用错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮助我:当我尝试运行该项目,这是在index.html`s的团长我的code:
Can somebody help me with this: When I try to run the project, this is my code in the index.html`s head:
<script type="text/javascript" src="barcodescanner.js"></script>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// PhoneGap is loaded and it is now safe to make calls PhoneGap methods
//
function onDeviceReady() {
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);
}
);
}
</script>
我收到以下错误:
I get the following error:
11-05 12:22:23.641: E/Web Console(454): ReferenceError: Can't find variable: PhoneGap at file:///android_asset/www/barcodescanner.js:57
该文件是在酒吧code扫描插件。它在正确的文件夹(项目/资产/ WWW)。有人会解决这个问题,将是巨大的。
谢谢
the file is from the bar code scanner plugin. Its in the correct folder (project/assets/www). Somebody would help with this, would be great. thanks
编辑:
行至极导致在酒吧codescanner.js问题说以下内容:
The line wich causes the problem in the barcodescanner.js says the following:
PhoneGap.addConstructor(function() {
PhoneGap.addPlugin('barcodeScanner', new BarcodeScanner());
});
推荐答案
我认为这个问题是这样的,你没有指定为您的PhoneGap-XX.js正确的路径在maain的HTML文件。
I think the issue is that, you have not specified the correct path for your phonegap-XX.js in your maain HTML file.
这篇关于PhoneGap的酒吧code扫描插件 - &GT;引用错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文