思い立ったが吉日!

iOSが好きです。

Podfileの書き方変わったし、Podfileをきれいにまとめて書く。

Podfileの書き方変わったし、Podfileをきれいにまとめて書く。

cocoapodsのversion 1.0にupdateしたついでにPodfileを書き換える。

Podfileの書き方が変わるので、Podfileを作り直す。 ( pod 'PromiseKit', '3.0.1'....のあたりは別でコピーとっておくんやで。)

rm -rf Podfile

pod init

ターゲットいっぱいあるので

target 'ProjectName-iOS-AdHoc' do

end

がいっぱいある。

複数のターゲットに同じPodをインストールする際に何度も書くのはよろしくない。(コピー漏れしそうだし。)

PodfileはRubyで書かれてるということが分かればきれいに書ける。

共通部分は定数にまとめて、各ターゲットはその定数をinstall。

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!

# インストールするpodをまとめた定数
def install_pods
  pod 'PromiseKit', '3.0.1'
  pod 'FrameAccessor', '2.0'
  pod 'LUKeychainAccess', '1.2.5'
  ........
end

# あとは定数をinstall
target 'ProjectName-iOS-AdHoc' do
    install_pods
end

target 'ProjectName-iOS-AdHocRelease' do
    install_pods
end

target 'ProjectName-iOS-Debug' do
    install_pods
end

target 'ProjectName-iOS-Release' do
    install_pods
end

target 'ProjectName-iOS-Store-AdHoc' do
    install_pods
end

target 'ProjectName-iOS-Store-Debug' do
    install_pods
end

target 'ProjectName-iOS-Store-Release' do
    install_pods
end

参考 qiita.com

↑だと

def install_pods do
end

になってるけど、

syntax error, unexpected keyword_end, expecting end-of-input.

でて怒られたんだけど、

def install_pods
end

でOK。 定数宣言だしね、