3

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
  • 5,372
  • 1
  • 31
  • 57

1 Answers1

2

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
Maurits van Beusekom
  • 5,579
  • 3
  • 21
  • 35