【问题标题】:Build error using Firebase and Geolocator (or any Swift plugin) in iOS (Flutter)在 iOS (Flutter) 中使用 Firebase 和 Geolocator(或任何 Swift 插件)构建错误
【发布时间】:2019-02-02 13:37:45
【问题描述】:

我正在尝试创建一个使用 Firebase 和 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.

据我所知,在 Podfile 中使用 Firebase 插件 requires you NOT to use_frameworks!。显然,由于 Geolocator 在 iOS 部分使用 Swift 代码,在 Podfile 中 it requires you TO use_frameworks!

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

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

【问题讨论】:

    标签: ios swift firebase flutter


    【解决方案1】:

    我不是这方面的专家,但看起来在您的 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
    

    【讨论】:

    • 我之前测试过它,但只用'3.2'!它适用于 4.0 和 4.1。非常感谢!
    • 很高兴听到,很高兴我能帮上忙。
    猜你喜欢
    • 2020-06-15
    • 1970-01-01
    • 1970-01-01
    • 2021-12-08
    • 1970-01-01
    • 2021-12-11
    • 2022-06-16
    • 1970-01-01
    • 2021-04-28
    相关资源
    最近更新 更多