khoren93 / flutter_zxing

Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms
https://pub.dev/packages/flutter_zxing
MIT License
89 stars 50 forks source link

stop reason = EXC_BAD_ACCESS (code=1, address=0x1062d8000) #61

Open E0lee opened 1 year ago

E0lee commented 1 year ago

i want to print a qrcode.

insert the code outside of class final result = zx.encodeBarcode( 'Text to encode', format: Format.qrCode, width: 300, height: 300, margin: 10, eccLevel: 0, );

put this code in the _MyHomePageState build function final imglib.Image img; Uint8List encodedBytes = Uint8List.fromList([0]); if (result.isValid && result.data != null) { img = imglib.Image.fromBytes(300, 100, result.data!.toList()); encodedBytes = Uint8List.fromList(imglib.encodeJpg(img)); // use encodedBytes as you wish }

console:

flutter version:3.3.10 library version:^0.9.0 ios:15.1

khoren93 commented 1 year ago

Hello @E0lee,

Thank you for your suggestion. As a temporary workaround, you could try using a smaller image size such as 120x120 for generating QR codes. This should help avoid any issues with large image sizes on iOS.

I am still working on finding a more permanent solution to this issue and will keep you updated as soon as I have any progress to report.

QuangHieu0611 commented 1 year ago

Hello @khoren93, I also encountered a similar error, and this error still exists in version 1.0.2. As your suggestion, I tried to create a code128 with a size of 174x87 without any errors. However, as soon as I increased the size to 175x88 or larger, the error occurred.

I am running my code on an iOS 16.2 simulator and I am able to generate large Code128 barcodes (300x150) without any issues. However, when I try to run the same code on a real device such as an iPad 12.5.7 or iPhone 16.2, I encounter these errors.

I have also noticed that the application ZXScanner (https://apps.apple.com/am/app/zxscanner/id1629106248) is experiencing the same issue when generating Code128 barcodes.

[Common] _BSMachError: port 11007; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"

0 0x00000001038345f4 in dart::BootstrapNatives::DN_TypedData_GetInt8(dart::Thread, dart::Zone, dart::NativeArguments*) ()

io.flutter.1.ui (9): EXC_BAD_ACCESS (code=1, address=0x10ebac000) Capture