【发布时间】:2016-05-28 18:40:23
【问题描述】:
我创建了一个 ionic 应用程序,它在 android 上运行良好。但是条码扫描器在 ios 中无法正常工作。
我的代码;
$cordovaBarcodeScanner.scan().then(function (barcodeData) {
console.log("Data : "+barcodeData.text);
});
当我尝试这样做时;
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);
},
{
"preferFrontCamera" : true, // iOS and Android
"showFlipCameraButton" : true, // iOS and Android
"prompt" : "Place a barcode inside the scan area", // supported on Android only
"formats" : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED
"orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device
}
};
收到此错误:
Warning: Attempt to present <CDVbcsViewController: 0x15f30c400> on <MainViewController: 0x15dd4fab0> whose view is not in the window hierarchy!
【问题讨论】:
-
尚未解决。请帮忙?
标签: angularjs cordova ionic-framework phonegap-plugins barcode-scanner