[iOS] ライブラリ管理ツール「CocoaPods」の使い方
MacアプリやiOSアプリ開発で使えるライブラリ管理ツール「CocoaPods」をインストールしました。
% gem install cocoapods |
% pod setup Setting up CocoaPods master repo Setup completed (read-only access) |
% pod --help CocoaPods, the Objective-C library package manager. Commands: * install Install project dependencies * ipc Inter-process communication * list List pods * outdated Show outdated project dependencies * push Push new specifications to a spec-repo * repo Manage spec-repositories * search Search pods * setup Setup the CocoaPods environment * spec Manage pod specs * update Update outdated project dependencies Options: --silent Show nothing --version Show the version of CocoaPods --no-color Show output without color --verbose Show more debugging information --help Show help banner of specified command |
■ エラー対応
[!] The platform of the target `Pods` (iOS 4.3) is not compatible with |
対応するiOSのバージョンを Podfile に指定すればOK
Podfile
platform :ios, '5.0' |
■ .gitignore に追加する項目
Pods/ MyPorjectName.xcworkspace |
■ Pods は別途、ビルドして libPods.a ファイルを作成する必要がある
ビルドしないと libPods.a ファイルが見つからないエラーが発生してしまう。
ld: library not found for -lPods |
Pods をビルドして libPods.a の作成するまでは、下記のサイトがとても分かりやすく参考になった。
・CocoaPodsを使ったXcodeプロジェクトの作り方(1) – shigeki.takeguchi.log
・CocoaPodsを使ったXcodeプロジェクトの作り方(2) – shigeki.takeguchi.log
・CocoaPodsを使ったXcodeプロジェクトの作り方(3) – shigeki.takeguchi.log
・CocoaPodsを使ったXcodeプロジェクトの作り方(4) – shigeki.takeguchi.log
[参考]
・CocoaPods: The Objective-C Library Manager
・CocoaPods ではじめる Objective-C ライブラリ管理 (1) – Watsonのメモ
・CocoaPodsでPodの利用&作成のメモ #Objective-C #CocoaPods – Qiita [キータ]