【Swift/Realm】Undefined symbolエラーでアーカイブ出来ない問題の解決法!

この記事からわかること

  • SwiftRealm発生したエラー解決法
  • アーカイブ出来ない原因
  • Undefined symbol: _$s10RealmSwift0A14CollectionImplPAAE12makeIteratorAA11RLMIteratorVy7ElementQzGyF
  • Undefined symbol: _$s10RealmSwift7ResultsVyxGAA0A14CollectionImplAAMc
  • missing module map file: '/Users/<ユーザー>/Desktop/<プロジェクト名>/Pods/Target Support Files/GoogleDataTransport/GoogleDataTransport.modulemap

index

[open]

\ アプリをリリースしました /

みんなの誕生日

友達や家族の誕生日をメモ!通知も届く-みんなの誕生日-

posted withアプリーチ

RealmSwift使用時にアーカイブがUndefined symbolエラービルド出来ない問題

環境

シミュレーターや実機へのビルドの際は問題なかったのですがアプリ審査のためにアーカイブ(Any iOS Device arm64)を作成しようとしたところ以下のようなエラーが発生しました。

Undefined symbol: _$s10RealmSwift0A14CollectionImplPAAE12makeIteratorAA11RLMIteratorVy7ElementQzGyF
Undefined symbol: _$s10RealmSwift7ResultsVyxGAA0A14CollectionImplAAMc

Undefined symbol:未定義エラー

発生したのは「Undefined symbol:未定義エラー」でした。とはいえエラー内容が少なく何が起きているか分かりません。

調べてみるとRealm Swiftのバージョンを最新にすることで解決することができるようです。

参考文献:Xcode 14.1 not building due to undefined symbols #8015

解決方法

私の場合はRealmのバージョンが10.29.0でしたので、これを現在の最新バージョンに更新していきます。

CocoaPodsでライブラリを更新するpod updateコマンドを実行します。

$ pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing FirebaseAnalytics 10.3.0 (was 9.3.0)
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
Installing Realm 10.34.0 (was 10.29.0)
Installing RealmSwift 10.34.0 (was 10.29.0)
Removing FirebaseCoreDiagnostics
Removing GoogleDataTransport
Generating Pods project
Integrating client project
Pod installation complete! There are 5 dependencies from the Podfile and 15 total pods installed.

他のライブラリも含めてこれで最新バージョンに更新されました。しかし再度ビルドしようとすると今度は以下のようなエラーが発生しました。これはRealmとは関係ないライブラリで起きたエラーのようです。

missing module map file: '/Users/<ユーザー>/Desktop/<プロジェクト名>/Pods/Target Support Files/GoogleDataTransport/GoogleDataTransport.modulemap

なので一度pod deintegrateでリセットしたあと、再度インストールし直すことでエラーを解消することが出来ました。

$ pod deintegrate
Deintegrating `LoanList.xcodeproj`
Deleted 1 'Check Pods Manifest.lock' build phases.
Deleted 1 'Embed Pods Frameworks' build phases.
- Pods_LoanList.framework
- Pods-LoanList.debug.xcconfig
- Pods-LoanList.release.xcconfig
Deleted 1 empty `Frameworks` groups from project.
Removing `Pods` directory.

Project has been deintegrated. No traces of CocoaPods left in project.
Note: The workspace referencing the Pods project still remains.

$ pod install                  
Analyzing dependencies
Downloading dependencies
Installing FirebaseAnalytics (10.3.0)
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
Installing Realm (10.34.0)
Installing RealmSwift (10.34.0)
Generating Pods project
Integrating client project
Pod installation complete! There are 5 dependencies from the Podfile and 15 total pods installed.

おすすめ記事:【Xcode】The app references non-public selectors : authenticationDidCompleteWithError:の解決法!アーカイブエラー

まだまだ勉強中ですので間違っている点や至らぬ点がありましたら教えていただけると助かります。

ご覧いただきありがとうございました。

searchbox

スポンサー

ProFile

ame

趣味:読書,プログラミング学習,サイト制作,ブログ

IT嫌いを克服するためにITパスを取得しようと勉強してからサイト制作が趣味に変わりました笑
今はCMSを使わずこのサイトを完全自作でサイト運営中〜

New Article

index