瀏覽代碼

bug: fix crash because of unsupported iOS version

flutter-beta
Julian Steenbakker 4 年之前
父節點
當前提交
f71f38491f
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: ACF0400DFB95F3FD
共有 1 個檔案被更改,包括 15 行新增11 行删除
  1. +15
    -11
      ios/Classes/QRView.swift

+ 15
- 11
ios/Classes/QRView.swift 查看文件

@@ -165,16 +165,20 @@ public class QRView:NSObject,FlutterPlatformView {
return
}
let bytes = { () -> Data? in
switch (code.descriptor) {
case let qrDescriptor as CIQRCodeDescriptor:
return qrDescriptor.errorCorrectedPayload
case let aztecDescriptor as CIAztecCodeDescriptor:
return aztecDescriptor.errorCorrectedPayload
case let pdf417Descriptor as CIPDF417CodeDescriptor:
return pdf417Descriptor.errorCorrectedPayload
case let dataMatrixDescriptor as CIDataMatrixCodeDescriptor:
return dataMatrixDescriptor.errorCorrectedPayload
default:
if #available(iOS 11.0, *) {
switch (code.descriptor) {
case let qrDescriptor as CIQRCodeDescriptor:
return qrDescriptor.errorCorrectedPayload
case let aztecDescriptor as CIAztecCodeDescriptor:
return aztecDescriptor.errorCorrectedPayload
case let pdf417Descriptor as CIPDF417CodeDescriptor:
return pdf417Descriptor.errorCorrectedPayload
case let dataMatrixDescriptor as CIDataMatrixCodeDescriptor:
return dataMatrixDescriptor.errorCorrectedPayload
default:
return nil
}
} else {
return nil
}
}()
@@ -190,7 +194,7 @@ public class QRView:NSObject,FlutterPlatformView {
}
return ["code": stringValue, "type": typeString, "rawBytes": safeBytes]
}()
guard let safeResult = result else { continue }
guard result != nil else { continue }
if allowedBarcodeTypes.count == 0 || allowedBarcodeTypes.contains(code.type) {
self?.channel.invokeMethod("onRecognizeQR", arguments: result)
}


Loading…
取消
儲存