CocoaPodsをインストールしてみた。

Mac OS X 10.8.2
Ruby関連は、アップデートはしてないはず。


基本的には下記を参考。
http://d.hatena.ne.jp/Watson/20111204/mac_dev_jp_advent_calendar_cocoapods01
なので、下記コマンドを実行。

sudo gem install cocoapods
略
Installing ri documentation for i18n-0.6.4...
Installing ri documentation for multi_json-1.6.1...
Installing ri documentation for activesupport-3.2.12...

unrecognized option `--encoding'

For help on options, try 'rdoc --help'

とか出てましたが、とりあえず気にせずに下記を実行。

pod --help

結果:

Your RubyGems version (1.3.6) is too old, please update with: `gem update --system`

ということで、言われた通り、下記を実行。

sudo gem update --system

すると、大量にログが出力されましたが、気にせず再度実行。

pod --help

なんか、それっぽいヘルプが出てきたので、下記を実行。

pod setup

すると、下記の出力。

Setting up CocoaPods master repo
Cloning spec repo `master' from `https://github.com/CocoaPods/Specs.git' (branch `master')

Cocoapods 0.17.0.rc4 is available.

Setup completed (read-only access)

とりあえず、セットアップは出来たらしい。

なので、TumeKyouen.xcodeproj が存在するディレクトリで

vim Podfile

で、内容に下記を記載。

platform :ios
dependency 'AFNetworking'


それでは、インストール

pod install TumeKyouen.xcodeproj

怒られた。

[!] Unrecognized argument: `TumeKyouen.xcodeproj'
pod install

とすると、

[DEPRECATED] `dependency' is deprecated (use `pod')
Resolving dependencies of `./Podfile'
Updating spec repositories

Cocoapods 0.17.0.rc4 is available.

Resolving dependencies for target `default' (iOS 4.3)
[!] AFNetworking (1.1.0) is not compatible with iOS 4.3.

との表示。

Podfileに

xcodeproj 'TumeKyouen.xcodeproj'

を追記し、

pod install

を実行しても、特に変化はなし。


で、PodfileのdependencyをAFNetworkingから、下記に変更。

dependency 'AdMob'

で、再度インストール

pod install

で、結果、

[DEPRECATED] `dependency' is deprecated (use `pod')
Resolving dependencies of `./Podfile'
Updating spec repositories

Cocoapods 0.17.0.rc4 is available.

Resolving dependencies for target `default' (iOS 4.3)
Downloading dependencies
Installing AdMob (6.3.0)
Generating support files

[!] From now on use `TumeKyouen.xcworkspace'.
Integrating `libPods.a' into target `TumeKyouen' of Xcode project `./TumeKyouen.xcodeproj'.

[!] The target `TumeKyouen [Debug - Release]' overrides the `OTHER_LDFLAGS' build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)' flag, or
    - Remove the build settings from the target.

あれ、通った?
とりあえず、

open TumeKyouen.xcworkspace

を実行したら、エラーになってしまって、よく考えると、TumeKyouen.xcodeproj を開いたままだったので、Xcodeを全て閉じ、再度

open TumeKyouen.xcworkspace

とすると、無事、開いて、ビルドも成功。
とりあえず、今日はここまで。

  • 3/16 追記

もともと入れていた、AdMobのリソースを削除したところ、コンパイルエラーになってしまった。
そこで、TumeKyouenプロジェクト -> Build Phases -> Link Binary With Libraries に、libGoogleAdMobAds.a を追加したところ、コンパイルが通るようになった。