← Back to list

CocoaPodsを使ったプロジェクトのビルドでコンパイルエラーが発生。

XcodeでiOSアプリをビルドするとき、CocoaPodsのエラーが発生してハマったので、戒めを含めて記録します。

tail -f my tech life. · 2019-06-18 02:14 · 5 claps · 3.2 min read
#xcode #swift #cocoapods #error #troubleshooting
Open on Medium ↗
Wiki topics: 📱 · Mobile Development

CocoaPodsを使ったプロジェクトのビルドでコンパイルエラーが発生。

XcodeでiOSアプリをビルドするとき、CocoaPodsのエラーが発生してハマったので、戒めを含めて記録します。

CocoaPodsを使ったプロジェクトをビルドするときに、Podsの問題や、プロジェクト設定がおかしくなりエラーが発生することがあります。

今回は、Swift製プロジェクトをビルドするときに、 ’FirebaseCore/FirebaseCore.h’ file not found が発生しました。

Swift Compiler Error
/xxx/Pods/Firebase/CoreOnly/Sources/Firebase.h:1:9: 'FirebaseCore/FirebaseCore.h' file not found
/xxx/picinfo/Preferences.swift:6:8: Could not build Objective-C module 'Firebase'

CocoaPodsを再設定する。

このエラーメッセージで検索すると、同様の現象の方の対策が見つかります。CocoaPods 側になんらかのビルド設定の問題が起きている場合は、プロジェクトのCocoaPodsを再設定すると良いようです。

[embed]Error: Could not build Objective-C module 'Firebase' Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question. Provide details and share…stackoverflow.com

There is only one way to solve this issue.

  1. Quit Xcode.
  2. Delete project’s temp files located at ~/Library/Developer/Xcode/DerivedData
  3. Delete ProjectName.xcworkspace
  4. Delete Podfile.lock file and Pods folder
  5. Run pod install.
  6. Open the newly created ProjectName.xcworkspace file and build.

Xcodeの中間ファイル・.xcworkspace・Podfile.lockを削除。 pod install を実行。 再度.xcworkspace を開く。

これでCocoaPodsのライブラリ群が再インストールされます。

Podsがビルドされていない。

自分の場合はCocoaPods再設定ではコンパイルエラーは解消されませんでした。(大ハマリしました)

原因は プロジェクトの Build Options — Find Implicit Dependenciesのチェックが外れているせいで、Podsがビルドされていませんでした。

Find Implicit DependenciesのチェックをONにするとビルドは成功しました。

Build Options — Find Implicit Dependenciesのチェックが外れている

Build Options — Find Implicit Dependenciesのチェックが外れている

なぜ Find Implicit DependenciesのチェックがOFFになっていたのか?

自分でOFFにしました…

Swiftのビルドが遅いので、しばらくPodsの更新がないからとOFFにして忘れていました…反省…


메타데이터
post_id
70626b3f01bf
slug
cocoapods-swift-compiler-error-70626b3f01bf
url
https://medium.com/@hdk2200/cocoapods-swift-compiler-error-70626b3f01bf
canonical_url
https://medium.com/@hdk2200/cocoapods-swift-compiler-error-70626b3f01bf
author_url
https://medium.com/@hdk2200
status
ok
fetched_at
2026-06-15 20:49:13