blitz-time アプリ開発ブログ

Androidアプリ開発などのTips集

【Swift開発】Undefined symbols for architecture arm64

RealmSwiftを利用したiOSアプリを開発しておりましたが、いざリリースビルドのために「Archive」を実施したところ、下記のエラーが出ました。

Undefined symbols for architecture arm64:
  "_$s10RealmSwift0A14CollectionImplPAAE12makeIteratorAA11RLMIteratorVy7ElementQzGyF", referenced from:
      _$s6R_Live11ReloadView2V4bodyQrvgyycfU0_ySo7NSTimerCYbcfU_ in ReloadView2.o
      _$s6R_Live10DatabaseExC26deleteAlbumsWithNoContentsyyF in DatabaseEx.o
      _$s6R_Live10DatabaseExC27deleteArtistsWithNoContentsyyF in DatabaseEx.o
      _$s6R_Live10DatabaseExC18resetSongActivatedyyFyyXEfU_ in DatabaseEx.o
  "_$s10RealmSwift7ResultsVyxGAA0A14CollectionImplAAMc", referenced from:
      _$s6R_Live11ReloadView2V4bodyQrvgyycfU0_ySo7NSTimerCYbcfU_ in ReloadView2.o
      _$s6R_Live10DatabaseExC26deleteAlbumsWithNoContentsyyF in DatabaseEx.o
      _$s6R_Live10DatabaseExC27deleteArtistsWithNoContentsyyF in DatabaseEx.o
      _$s6R_Live10DatabaseExC18resetSongActivatedyyFyyXEfU_ in DatabaseEx.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Google先生に聞いたところ、下記に情報がありました。
github.com

上記リンクによると、

pod update
clean build folder
build

を実施すればよいとのこと。

やってみました。。。。。だめでした。同じエラーのままです。

上記リンクの情報では、「RealmSwift 10.32.2」を使っていたとのことですが、こちらのプロジェクトでは「RealmSwift 10.25.1」でした。Podfileを更新して「RealmSwift 10.32.2」にしてから、再度、

pod update
clean build folder
build

をやってみました。。。。。いけました!

とはいえ、RealmSwiftのバージョンをあげたので、データベース周りの動作確認が再度必要です。