4
5

More than 3 years have passed since last update.

【Xcode】Module compiled with Swift 5.x.x cannot be imported by the Swift 5.x compiler【Carthage】

Posted at

複数のSwiftバージョンの違うXcodeをインストールした状態でアプリをビルドすると

Module compiled with Swift 5.x.x cannot be imported by the Swift 5.x compiler

のエラーが発生することがあります(xのところは具体的なバージョン)。これはCarthageのモジュールとXcodeでビルドしようとしているもののSwiftバージョンが異なりますというエラーです。
その場合はCarthageのビルドを使いたいXcodeのSwiftバージョンに合わせなければなりません。
その際はxcode-selectコマンドを使います。

sudo xcode-select -switch /Applications/Xcode-beta.app/Contents/Developer

のようにxcode-selectコマンドでCarthageが見るXcodeの向き先を変えてあげます。
念の為に、変更前に現在のpathを確認したい場合は

sudo xcode-select -p

で現在のpathがわかるので、戻したい場合は現在のpathをメモっておくと安心です。

4
5
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
4
5