LoginSignup
6
4

More than 5 years have passed since last update.

Xcode 8.1 -> 8.2でSwiftバージョンエラーが出る問題

Last updated at Posted at 2016-12-15

追記: この問題はXcode8.2.1アップデートで修正されました(Xcode Release Notesより)


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

これまでXcode 8.1 (macOS Sierra)まではUse Legacy Swift Language VersionNOにしてSwift 3.0をビルドしていました。しかしXcode 8.2へアップデートしたところ上記エラーでビルドできなくなりました。

対処法

Apple Developer Forums - XCode 8.2, does not detect that my project already is migrated to Swift 3

手順

  1. .xcodeprojフォルダ内やPodsフォルダ内にある.pbxprojファイルのSWIFT_VERSION3.0.1となっていた場合、すべて3.0に書き換える
  2. 対象プロジェクトのUse Legacy Swift Language VersionNoからYesにしてビルドを失敗させる
  3. 対象プロジェクトのUse Legacy Swift Language Versionを再びNoに戻してビルドすることで解消する

アップデート後のXcode 8.2はSwift 3.0.1を2.3として認識しエラーを出すようです。

同じくXcode 8.1 -> 8.2とした別Mac(Mac OS X El Captan)ではこの問題は発生しませんでした。

6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4