xcode 8 swift错误更新“使用遗留swift语言版本”

时间:2022-10-06 09:48:03

When i opened my project into Xcode 8 then I got the following error

当我将项目打开到Xcode 8时,我得到了以下错误

Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly

referring to a similar post on * , Use Legacy Swift Language Version YES/NO . But it's not working for me either by doing YES or No value ?

关于*上的一个类似的帖子,使用Legacy Swift语言版本是/否。但做“是”或“否”对我来说也不奏效?

Please help.

请帮助。

I have checked Use Legacy Swift Language Version to options YES/NO please check attached screenshot xcode 8 swift错误更新“使用遗留swift语言版本”

我已经检查过使用遗留的Swift语言版本的选项是/否,请查看附件的截图

xcode 8 swift错误更新“使用遗留swift语言版本”

5 个解决方案

#1


15  

Add this to your pod-file:

将此添加到您的磁盘文件:

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'yourappname' do

pod 'yourpodlists'

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '2.3'  ## or '3.0'
        end
    end
end
end

Run pod-install again. Clean your project with cdm + alt + shift + k. Clean again using cmd + shift + k. Restart Xcode. Build. Now it should work.

再次运行pod-install。用cdm + alt + shift + k清洗项目,再用cmd + shift + k清洗,重新启动Xcode。构建。现在应该工作。

If you're not using cocoapods, you should be able to fix this issue by setting the Compiler Version attribute Use Legacy Swift Language Version from unspecified to Yes or No.

如果您不使用cocoapods,您应该能够通过将编译器版本属性设置为使用遗留的Swift语言版本来解决这个问题。

Build settings of the project or library ->

构建项目或库的设置——>

xcode 8 swift错误更新“使用遗留swift语言版本”

#2


2  

try converting swift code to swift3 or swift 2.3. edit -> convert -> to current swift-> select swift 3 or swift 2.3. This will works.

尝试将swift代码转换为swift3或swift 2.3。编辑->转换->到当前的swift->选择swift 3或swift 2.3。这将工作。

#3


1  

xcode 8 swift错误更新“使用遗留swift语言版本”I am using Xcode 8.3.3 After surfing too much and working around i found this solution, and this worked for me.

我使用Xcode 8.3.3,在浏览了太多的东西之后,我找到了这个解决方案,这对我很有效。

Here are the steps.
1=> select your target from Xcode
2=> go to build setting
3=> search for "Swift Language Version"
4=> change it to swift 3. (or accordingly.)

#4


0  

If you're not using pods just add this to your Info.plist - I'm on 2.3xcode 8 swift错误更新“使用遗留swift语言版本”

如果你不使用豆荚,就把它添加到你的信息中。plist -我在2.3。

as the option wasn't listed in build settings.

因为在构建设置中没有列出这个选项。

#5


0  

As reference to this, This is what I've concluded (for Xcode 8) :

关于这一点,这是我所总结的(对于Xcode 8):

  1. If your code is in swift version = 2.3 then you just need to set Use Legacy Swift Language Version to YES in build setting and you will good to go.
  2. 如果您的代码是swift版本= 2.3,那么您只需要在构建设置中将“使用遗留的swift语言版本”设置为“是”就可以了。
  3. If your code is in swift version < 2.3 then :

    如果您的代码是swift版本< 2.3,则:

    i) convert your code to swift 2.3 and Set 'Use Legacy Swift Language Version = YES'

    i)将您的代码转换为swift 2.3并设置“使用遗留swift语言版本= YES”

    OR

    ii) convert your code to latest swift version (might be 3.0) and Set 'Use Legacy Swift Language Version = NO'

    ii)将您的代码转换为最新的swift版本(可能是3.0),并设置“使用遗留的swift语言版本= NO”

In my case, I've used external library which was in swift 2.2 causing errors in Xcode 8.0, so I replace the same library with swift version 2.3 and used above solution 2.i). Now everything is fine.

在我的例子中,我使用了swift 2.2中的外部库,导致了Xcode 8.0中的错误,所以我用swift 2.3替换了相同的库,并使用了上面的解决方案2.i)。现在一切都很好。

Hope this help someone who are seeking the solution to this problem.

希望这对正在寻求解决这个问题的人有所帮助。

#1


15  

Add this to your pod-file:

将此添加到您的磁盘文件:

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'yourappname' do

pod 'yourpodlists'

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '2.3'  ## or '3.0'
        end
    end
end
end

Run pod-install again. Clean your project with cdm + alt + shift + k. Clean again using cmd + shift + k. Restart Xcode. Build. Now it should work.

再次运行pod-install。用cdm + alt + shift + k清洗项目,再用cmd + shift + k清洗,重新启动Xcode。构建。现在应该工作。

If you're not using cocoapods, you should be able to fix this issue by setting the Compiler Version attribute Use Legacy Swift Language Version from unspecified to Yes or No.

如果您不使用cocoapods,您应该能够通过将编译器版本属性设置为使用遗留的Swift语言版本来解决这个问题。

Build settings of the project or library ->

构建项目或库的设置——>

xcode 8 swift错误更新“使用遗留swift语言版本”

#2


2  

try converting swift code to swift3 or swift 2.3. edit -> convert -> to current swift-> select swift 3 or swift 2.3. This will works.

尝试将swift代码转换为swift3或swift 2.3。编辑->转换->到当前的swift->选择swift 3或swift 2.3。这将工作。

#3


1  

xcode 8 swift错误更新“使用遗留swift语言版本”I am using Xcode 8.3.3 After surfing too much and working around i found this solution, and this worked for me.

我使用Xcode 8.3.3,在浏览了太多的东西之后,我找到了这个解决方案,这对我很有效。

Here are the steps.
1=> select your target from Xcode
2=> go to build setting
3=> search for "Swift Language Version"
4=> change it to swift 3. (or accordingly.)

#4


0  

If you're not using pods just add this to your Info.plist - I'm on 2.3xcode 8 swift错误更新“使用遗留swift语言版本”

如果你不使用豆荚,就把它添加到你的信息中。plist -我在2.3。

as the option wasn't listed in build settings.

因为在构建设置中没有列出这个选项。

#5


0  

As reference to this, This is what I've concluded (for Xcode 8) :

关于这一点,这是我所总结的(对于Xcode 8):

  1. If your code is in swift version = 2.3 then you just need to set Use Legacy Swift Language Version to YES in build setting and you will good to go.
  2. 如果您的代码是swift版本= 2.3,那么您只需要在构建设置中将“使用遗留的swift语言版本”设置为“是”就可以了。
  3. If your code is in swift version < 2.3 then :

    如果您的代码是swift版本< 2.3,则:

    i) convert your code to swift 2.3 and Set 'Use Legacy Swift Language Version = YES'

    i)将您的代码转换为swift 2.3并设置“使用遗留swift语言版本= YES”

    OR

    ii) convert your code to latest swift version (might be 3.0) and Set 'Use Legacy Swift Language Version = NO'

    ii)将您的代码转换为最新的swift版本(可能是3.0),并设置“使用遗留的swift语言版本= NO”

In my case, I've used external library which was in swift 2.2 causing errors in Xcode 8.0, so I replace the same library with swift version 2.3 and used above solution 2.i). Now everything is fine.

在我的例子中,我使用了swift 2.2中的外部库,导致了Xcode 8.0中的错误,所以我用swift 2.3替换了相同的库,并使用了上面的解决方案2.i)。现在一切都很好。

Hope this help someone who are seeking the solution to this problem.

希望这对正在寻求解决这个问题的人有所帮助。