Html5移动开发论坛

注册

 

发新话题 回复该主题

我条码扫描报错,Phonegap2.3 + html5 调用BarcodeScanner [复制链接]

1#
04-22 16:57:07.962: E/Web Console(25473): Uncaught TypeError: Cannot call method 'exec' of undefined at
file:///android_asset ml/barcodescanner.js:36

我条码扫描的报上面的错。
那一行是:
    cordova.exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', []);

哪位兄弟能帮帮忙?
index.html头
    <script src="cordova-2.3.0.js" type="text/javascript"></script>    
    <script src="barcodescanner.js" type="text/javascript"></script>    
    <script type="text/javascript">
        function scanbar(){     
            window.plugins.barcodeScanner.scan(        
                function(result) {        
                        alert("Scanned Code: " +
                                result.text   +
                                ". Format: " + result.format   +
                                ". Cancelled: " + result.cancelled
                                );    
                        }, function(error)
                    {        
                        alert("Scan failed: " + error);    
                    }
            );
        }
    
    </script>
分享 转发
TOP
2#

xml里面注册了没

Sencha Touch 交流 QQ 群 224711028 欢迎您的加入。
PhoneGap安卓 交流 QQ 群 250395324欢迎您的加入。
Html5 APP 交流 QQ 群 273843464欢迎您的加入。
TOP
发新话题 回复该主题