LoginSignup
6
3

More than 5 years have passed since last update.

CarthageでModule compiled with Swift * cannot be imported in Swift *の対処法

Last updated at Posted at 2016-10-31

TL;DR

carthage update --no-use-binariesを使おう

エラー内容

SwiftyJSONをimportした時のエラー
Module compiled with Swift 3.0 cannot be imported in Swift 3.0.1

なぜ起こるのか

そもそもcarthage updateで何をしているかというと、SwiftyJSONを例にすると、

cartfile
github "SwiftyJSON/SwiftyJSON"

このように書いて
$ carthage update
でgithubのSwiftyJSONを持ってくる

しかし、carthageのbootstrapやupdateは取ってくる先にビルド済のバイナリがあった場合、それを持ってきて展開してしまう
だからswift3.0でコンパイルされているSwiftyJSONがimportされてしまっている

対処法

carthageの--no-use-binariesを使ってあげると、バイナリではなくソースコードを持ってきてこちら側でビルドしてくれる
時間はかかるようになってしまうが、これでエラーが解消される

6
3
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
3