From f2902bf9829d9f6a51efed6b885e2ba69ab388e0 Mon Sep 17 00:00:00 2001 From: Navaron Bracke Date: Tue, 10 Sep 2024 14:41:23 +0200 Subject: [PATCH] fix url for macos --- .../Sources/mobile_scanner/MobileScannerPlugin.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macos/mobile_scanner/Sources/mobile_scanner/MobileScannerPlugin.swift b/macos/mobile_scanner/Sources/mobile_scanner/MobileScannerPlugin.swift index 4f147ea5d..b840e5a0e 100644 --- a/macos/mobile_scanner/Sources/mobile_scanner/MobileScannerPlugin.swift +++ b/macos/mobile_scanner/Sources/mobile_scanner/MobileScannerPlugin.swift @@ -458,7 +458,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, let argReader = MapArgumentReader(call.arguments as? [String: Any]) let symbologies:[VNBarcodeSymbology] = argReader.toSymbology() - guard let fileUrl: URL = URL(string: argReader.string(key: "filePath") ?? "") else { + guard let filePath: String = argReader.string(key: "filePath") else { // TODO: fix error code result(FlutterError(code: "MobileScanner", message: "No image found in analyzeImage!", @@ -466,6 +466,8 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, return } + let fileUrl = URL(fileURLWithPath: filePath) + guard let ciImage = CIImage(contentsOf: fileUrl) else { // TODO: fix error code result(FlutterError(code: "MobileScanner",