Skip to content

Barcode Scanners are not working on iOS after Flutter 3.24.0 upgrade #738

@darielkurt

Description

@darielkurt

Describe your issue. If applicable, add screenshots to help explain your problem.

The issue started after the Flutter 3.24.0 upgrade.
It is working well with Android but in iOS we encountered a problem
First one was the camera is not working, this was solved by disabling the Impeller:

<key>FLTEnableImpeller</key>
<false />

Now the camera is working, the scanning now is not working

Tried aligning the podfile to the one indicated in the documentation, tried upgrading text recognition and firebase packages also. Still not working.

Here is the Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '15.5.0'  # or newer version
$iOSVersion = '15.5.0'  # or newer version

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks! :linkage => :static
  use_modular_headers!
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
    # share_handler addition start
    target 'ShareExtension' do
      inherit! :search_paths
      pod "share_handler_ios_models", :path => ".symlinks/plugins/share_handler_ios/ios/Models"
    end
    # share_handler addition end
end

post_install do |installer|
  # add these lines:
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=*]"] = "armv7"
    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
  end

  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      if Gem::Version.new($iOSVersion) > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
      end
#       config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'i386 arm64'
    end
  end
end

Steps to reproduce.

Image

This is the barcode scanning screenshot, notice that the barcode is clear. I also tried scanning beyond the scanning area to check if the the problem is just the scanning area.

What is the expected result?

I expected the barcode scanner and qr code scanner will work completely fine

Did you try our example app?

Yes

Is it reproducible in the example app?

No

Reproducible in which OS?

iOS

Flutter/Dart Version?

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.0, on macOS 14.4.1 23E224
darwin-arm64, locale en-PH)
[✓] Android toolchain - develop for Android devices (Android SDK
version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.95.3)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!

Plugin Version?

We have tried two versions:

  • google_mlkit_barcode_scanning: ^0.12.0
  • google_mlkit_barcode_scanning: ^0.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions