Build error using Firebase and Geolocator (or any Swift plugin) in iOS (Flutter)

2,271

I am not an expert in this area but it looks like specifying the Swift version in your Podfile might solve the above mentioned error. You can do so by adding the following line:

config.build_settings['SWIFT_VERSION'] = '4.1'

It should be part of the post_install block, like this:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['SWIFT_VERSION'] = '4.1'
    end
  end
end
Share:
2,271
Feu
Author by

Feu

It's not about the technology, it is about what the technology is used for.

Updated on December 06, 2022

Comments

  • Feu
    Feu over 1 year

    I'm trying to create a flutter app which use Firebase and the Geolocator plugin.

    • The Firebase plugins I'll use to authenticate, use the RTDB and FCM.
    • The Geolocator is apparently a very reliable plugin for location awareness.

    In Android, that's all fine - everything works great!

    In iOS however, I cannot build the app, the error:

    The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.

    As I learned, using the Firebase plugins requires you NOT to use_frameworks! in the Podfile. And apparently, as Geolocator uses Swift code in the iOS part, it requires you TO use_frameworks! in the Podfile.

    I know I could use another GPS plugin, such as Location, however as it applies for any Swift code plugin, my question is:

    With Flutter, is it possible to use Firebase together with any Swift plugin?

  • Feu
    Feu over 5 years
    I have tested it previously, but only with '3.2'! It worked both with 4.0 and 4.1. Thank you very much!
  • Maurits van Beusekom
    Maurits van Beusekom over 5 years
    That’s great to hear, glad I could help.