'iOS thread 0 app crash when trying to read file from temporary directory

My iOS app is crashing when reaching line await _qrCodeScanner.processImage(InputImage.fromFile(file));

On Android it's working fine.

This is my code for this, using https://pub.dev/packages/google_ml_kit and https://pub.dev/packages/path_provider:

_qrCodeScanner = GoogleMlKit.vision
        .barcodeScanner(<BarcodeFormat>[BarcodeFormat.qrCode]);
getTemporaryDirectory().then((value) {
      _tempDir = value;
});
File file = await File('${_tempDir.path}/image.png').create();
file.writeAsBytesSync(frame.asUint8List());
await _qrCodeScanner.processImage(InputImage.fromFile(file));

I excluded armv7 in Xcode and in my Podfile:

platform :ios, '12.0'

...some code...
post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=*]"] = "armv7"
    end

installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|

          # You can enable the permissions needed here. For example to enable camera
          # permission, just remove the `#` character in front so it looks like this:
          #
          # ## dart: PermissionGroup.camera
          # 'PERMISSION_CAMERA=1'
          #
          #  Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
            '$(inherited)',

            //...permissions... 
            // I allowed camera and microphone
          ]

        end
        # End of the permission_handler configuration
    end
end


I can also attach my crash log but I have problem with symbolicate it. I can symbolicate by line. Crash log is saying

Exception Type:  EXC_CRASH (SIGABRT)

Exception Codes: 0x0000000000000000, 0x0000000000000000

Exception Note:  EXC_CORPSE_NOTIFY

Triggered by Thread:  0

I am new with iOS development, what I can do with this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source