iamxxy 发表于 2015-12-7 15:57:32

phonegap.plugins.barcodescanner在ios上遇到的奇怪的问题

在Android上正常,在iOS不正常。用一个button设定ng-click='scan()',然后在controller中定义scan,
$scope.scan = function(){
cordova.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);
      }
   );
}点开之后扫码界面出现了但是一动不动定格在那里(就像卡死)

我只需要在
$scope.scan = function(){
<font color="#ff0000">alert("Xxxx);</font>
cordova.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);
}
);
}多加一个alert,然后扫码界面就能正常的调出来而且会正常工作。

实在太纠结为什么会有这样的情况,请教。

页: [1]
查看完整版本: phonegap.plugins.barcodescanner在ios上遇到的奇怪的问题