使用iOS中的Firebase和Geolocator(或任何Swift插件)构建错误(Flutter)

我正在尝试使用Firebase和Geolocator插件创建一个颤动的应用程序。

  • 我将使用Firebase插件进行身份validation ,使用RTDB和FCM 。
  • Geolocator显然是一个非常可靠的位置感知插件。

在Android中,一切都很好 – 一切都很棒!

但是在iOS中,我无法构建应用程序,错误:

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.

据我所知 ,使用Firebase插件需要你不要使用_frameworks! 在Podfile中。 显然,当Geolocator在iOS部分使用Swift代码时, 它需要你使用use_frameworks! 在Podfile中。

我知道我可以使用另一个GPS插件,例如Location ,但是因为它适用于任何Swift代码插件,我的问题是:

使用Flutter,是否可以将Firebase与任何Swift插件一起使用?

我不是这方面的专家,但看起来在Podfile指定Swift版本可能会解决上面提到的错误。 您可以通过添加以下行来执行此操作:

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

它应该是post_install块的一部分,如下所示:

 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