【CocoaPods】Podfileの書き方が変わっていた。

Cocoa podの Podfileの書き方が変わったらしい。

新しいMacになってCocoaPodsを使おうとしたらpodって何?って言われた。(^_^;)

すっかりやり方を忘れたので
超初心者向け【cocoapods】の始め方。 | iPhoneアプリ備忘録
これを参考にCocoaPodsをインストールし直した。

んで、以前のままのPodfileを使おうとしたら怒られた。

$ pod install
Re-creating CocoaPods due to major version update.
Analyzing dependencies
[!] The dependency `Google-Mobile-Ads-SDK (~> 7.0)` is not used in any concrete target.
The dependency `Google/Analytics` is not used in any concrete target.

調べてみたらなんか書き方が変わったらしい。
参考サイト
Cocoapods 1.0.0で注意すること – Qiita

pod initでPodfileを作成して開くとこのような内容になっていた。

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'アプリ名' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for アプリ名

  target 'アプリ名Tests' do
    inherit! :search_paths
    # Pods for testing
  end

end

なので書き直した。

# Uncomment the next line to define a global platform for your project
 platform :ios, '9.0'

target 'アプリ名' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
   use_frameworks!

pod 'Google-Mobile-Ads-SDK', '~> 7.0'
pod 'Google/Analytics'

  # Pods for アプリ名

  target 'アプリ名Tests' do
    inherit! :search_paths
    # Pods for testing
  end

end

んで、pod installを実行したところ

$ pod install
Re-creating CocoaPods due to major version update.
Analyzing dependencies
Downloading dependencies
Installing Google (2.0.4)
Installing Google-Mobile-Ads-SDK (7.7.1)
Installing GoogleAnalytics (3.14.0)
Installing GoogleInterchangeUtilities (1.2.0)
Installing GoogleNetworkingUtilities (1.2.0)
Installing GoogleSymbolUtilities (1.1.0)
Installing GoogleUtilities (1.3.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 7 total pods installed.

こんな感じで無事に成功したようだ。

2019年3月2日追記
さらに記事書きました。
【cocoapods】たまにしか使わないのですぐにわからなくなる。/(^o^)\ | iPhoneアプリ備忘録

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です