flutter-ml / google_ml_kit_flutter

A flutter plugin that implements Google's standalone ML Kit
MIT License
907 stars 709 forks source link

Failed to build iOS app when I add Google MLkit Barcode Scanning #649

Open Gon3s opened 6 days ago

Gon3s commented 6 days ago

Hello,

I create an application Flutter with a barcode scanner. I want to use Google ML Kit but when I add the plugin google_mlkit_barcode_scanning, I can build Android app but the iOS app failed to build.

I have this error :

enter image description here

I try to change Exclude Architecture like this : enter image description here

And the podfile like this :

platform :ios, '12.0'  # or newer version

...

# add this line:
$iOSVersion = '12.0'  # or newer version

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)

    # add these lines:
    target.build_configurations.each do |config|
      if Gem::Version.new($iOSVersion) > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
      end
    end

  end
end

But nothing works.

I try to launch example from this : https://github.com/flutter-ml/google_ml_kit_flutter/tree/develop/packages/example and it's work but I don't find the difference between my code and example code.

thanks :)