'Can't build flutter application for ios?

I'm using mapbox_gl for my project, when I build the app for ios iPad pro (9.7-inch) I got this error:-

Building for iOS Simulator, but linking in dylib built for iOS, file '...project_name/ios/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Mapbox' for architecture arm64



Solution 1:[1]

this looks similar to https://github.com/mapbox/mapbox-gl-native-ios/issues/487

adding this to the podfile fixed this for me in flutter on an m1 mac

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Solution 2:[2]

According to this issue - https://github.com/flutter-mapbox-gl/maps/issues/890

just add the following to your podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 i386 armv7"

    end
  end
end

replacing

 post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

as mentioned by @samia also . This all worked for me too

  • Now, For platform issue just uncomment # platform :ios, '9.0' , in your podfile and set it to '10.0' instead of '9.0' (although I didn't need this for mapbox)
  • For second warning , I ignored it and app works fine for me

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Samia Ashraf
Solution 2 Ritik Jain