ごらくらいふ

プログラミングしたりゲームしたり

既存のXcodeプロジェクトにCocoaPodsを入れたらビルドエラー ld: library not found for -lPods

既存のプロジェクトにCocoaPodsを入れて、早速buildしたら次のようなエラーが出た。

ld: library not found for -lPods-ProjectName

対処方法をggrといくつかあって悩んだので、*1*2公式を確認した。

guides.cocoapods.org

Using the CocoaPods Project項目4 に答えがあった。

If Xcode complains when linking, e.g. Library not found for -lPods, it doesn't detect the implicit dependencies:
  • Go to Product > Edit Scheme
  • Click on Build
  • Add the Pods static library, and make sure it's at the top of the list
  • Clean and build again

以下にも続きがあるが、自分はこの時点で解決した。

他プロジェクトの生成物を使うので、先にbuildしましょう。ということかと。

Manage schemeで別途buildすると、「ライブラリのアップデートが反映されねぇ!」ってなりそうだからこっちの方法が良さそう。

*1:Manage schemeからPodsプロジェクトをshowするとか

*2:Edit schemeで対処するとか