對於我正在開發的項目,必須有掃描QR碼的方法。我從phonegap-plugin-barcodescanner得到這個。因爲它在Android上運行良好,從來沒有任何問題。Phonegap插件barcodescanner在iOs上崩潰
但是在iOs上,它會按原樣崩潰。您將收到使用相機的請求,然後應用程序崩潰。我在這發現的方式是刪除它的選項部分,然後它的工作。
這看起來像是一種奇怪的方式來解決它。 問題:有沒有更好的方法來解決這個問題?
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
}
);
使用:視窗10,英特爾XDK v3619,科爾多瓦CLI 6.2.0和PhoneGap的-插件,barcodescanner 4.1.0
對不起,我提出一個啞巴解決方案,但它爲我工作...對我來說,崩潰發生在Android上,我做的是:我刪除了android平臺(科爾多瓦plartform RM Android),定義最新的科爾多瓦CLI進行編譯(curren tly 6.4.0)。實際上構建失敗了,所以我回到了以前爲我工作的CLI(6.1.1),並重新添加了android平臺(cordova platform add android)。然後,miracuosly開始工作,並停止崩潰。嘗試平臺「ios」。也可以爲你工作。 – Lentyai