Use Legacy Swift Language Version - Xcode 8.2

后端 未结 9 628
滥情空心
滥情空心 2020-12-25 13:47

After updating to Xcode 8.2 the compiler throws one error for my App target:

“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be con

相关标签:
9条回答
  • 2020-12-25 14:06

    This did not work for us :( reverting back to Xcode 8.1 is best for now until Apple QA's their stuff before they release.

    If its any consolation here are things we tried and got us very close. We got stuck at the Clean Failed:

    rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache

    rm -rf ~/Library/Preferences/com.apple.Xcode.plist

    restart Xcode and do a deep clean holding the option key

    That got rid of the Clean Failed.

    Adding this to your pod script

    post_install do |installer|

    installer.pods_project.targets.each do |target|

    target.build_configurations.each do |config|

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

    end

    end

    end

    That is the way to have all pods conform to 3.0 and we actually got it to build, but at the end of compiling we got this error:

    “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.
    

    How do we change the workspace so that all projects conform to swift 3.0? Where is that setting?

    0 讨论(0)
  • 2020-12-25 14:12

    Fixed in Xcode 8.2.1.

    Here is a copy of the integrality of the changelog of Xcode 8.2.1:

    Swift

    Resolved Issues

    • Fixed an issue that could cause building a project to fail with the error message “"Use Legacy Swift Language Version" (SWIFT_VERSION) is required to be configured correctly for targets which use Swift” when using a supported version of Swift. (29667880)
    • Xcode no longer warns about using deprecated Swift 2.3 code when the active scheme does not reference targets using Swift 2.3 code. (29671741)
    0 讨论(0)
  • 2020-12-25 14:13

    This is the only thing that worked for me...

    For errors with pods. Basically we need to enable “Legacy Swift Language”. Select your pod framework (by clicking on it in the error navigator) and under Build Settings find “Use Legacy Swift Language Version”

    Set it to “Yes”. Then “Build & Run” again to test it.

    Check out this post: http://rebeloper.com/downgrade-swift-3-swift-2-3-xcode-8/

    0 讨论(0)
  • 2020-12-25 14:20

    Found work around. I went through each target (and project settings, so both in the project and target) in my project, toggled the "Use Legacy Swift Language Version" from "No" to "Yes" and back to "No" for each. The project then built again.

    0 讨论(0)
  • 2020-12-25 14:23

    It turns out that Apple decided to reference a version of the swift language that doesn't exist yet within the pbxprojec file. They hard coded 3.0.1, and by manually editing the sudo XML in the pbx file back to 3.0 everything worked again. Apple apparently overlooked some simple QA work before they released 8.2

    This could also explain why toggling between legacy in the build settings worked for some people.

    0 讨论(0)
  • 2020-12-25 14:29

    I got the same error. I tried for searching "Use Legacy Swift Language Version", but not found. I am using Xcode 8.3.3 After surfing too much and working around i found this solution, and this worked for me.

    Follow these 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.)
    

    Hope this work for you.

    0 讨论(0)
提交回复
热议问题