简体   繁体   English

Flutter iOS构建在带有swift_version的Xcode 10.1中失败

[英]Flutter ios build fails in xcode 10.1 with swift_version

I'm building a flutter app. 我正在构建一个Flutter应用程序。 everyting worked just fine. 一切都很好。 Then I think dart was upgraded and suddenly the build of the app fails with this error: 然后,我认为dart已升级,突然应用程序的构建失败并显示以下错误:

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. 对于使用Swift的目标,必须将“ Swift语言版本”(SWIFT_VERSION)构建设置设置为支持的值。 Supported values are: 3.0, 4.0, 4.2. 支持的值为:3.0、4.0、4.2。 This setting can be set in the build settings editor. 可以在构建设置编辑器中设置此设置。

I don't see the setting in xcode and not sure what caused this error. 我没有在xcode中看到设置,并且不确定是什么导致了此错误。 Anyone else seen it? 其他人看到了吗?

For anyone else looking for the solution. 对于寻求解决方案的其他任何人。 You need to have XCode version higher than 10.0 before you can use Swift 4.2. 您必须具有高于10.0的XCode版本,然后才能使用Swift 4.2。

Open your podfile and make the following changes 打开您的podfile并进行以下更改

target 'Runner' do
  use_frameworks! # <---- // 1st add this right below above line
  ...
end

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.2' # <--- // 2nd add this
    end
  end
end

After this, in terminal use flutter run . 此后,在终端中使用flutter run More info 更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM