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 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.
But have it set to No
in all targets I have. Tried to remove Derived Data, clean project dir, restart Xcode. Nothing helps. Anyone figure it out?
// Edited
Just to be sure: I have set to ALL my targets Use Legacy Swift Language Version
to No
and the project worked alright when compiled in Xcode 8.1. It doesn't work after updating to Xcode 8.2.
// Edit 21.12.
The issue has been fixed in Xcode 8.2.1
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.
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)
Close Xcode and open the corresponding project.pbxproj
in a text editor of your choice.
Replace SWIFT_VERSION = 3.0.1;
with SWIFT_VERSION = 3.0;
for all targets.
Reopen Xcode.
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/
Well I've finally figure it out. I've removed the project and clone it again, restarted Xcode, run pod repo update
and pod install
and it worked. I've no idea why.
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?
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.
I got the same error when converting parts of my app (both Obj C and Swift) to a framework, but in my case it was that the "Swift Language Version" under Build Settings wasn't set. I set it to Swift 3 (the only option), and the error went away.
来源:https://stackoverflow.com/questions/41118912/use-legacy-swift-language-version-xcode-8-2