在iOS(Flutter)中使用Firebase和Geolocator(或任何Swift插件)生成错误 [英] Build error using Firebase and Geolocator (or any Swift plugin) in iOS (Flutter)

查看:174
本文介绍了在iOS(Flutter)中使用Firebase和Geolocator(或任何Swift插件)生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

在Android中,一切都很好-一切正常!

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

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

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.

据我了解,使用Firebase插件不需要您使用use_frameworks!在Podfile中.显然,由于Geolocator在iOS部分使用Swift代码,因此它要求您使用use_frameworks !在Podfile中.

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.

我知道我可以使用其他GPS插件,例如位置,但是适用对于任何Swift代码插件,我的问题是:

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

通过Flutter,可以将Firebase与任何Swift插件一起使用吗?

推荐答案

我不是该领域的专家,但是看起来在您的Podfile中指定Swift版本可能会解决上述错误.您可以通过添加以下行来做到这一点:

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'

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

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

这篇关于在iOS(Flutter)中使用Firebase和Geolocator(或任何Swift插件)生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆