【Swift4】【Firebase】【AdMob】と【Analytics】(1) SDKを【cocoaPods】でインストール

【cocoapods】たまにしか使わないのですぐにわからなくなる。/(^o^)\ | iPhoneアプリ備忘録
前回↑から引き続きFirebaseのadMobを入れていきます。

参考サイト
iOS 用 Firebase 向け Google アナリティクスを使ってみる  |  Firebase
スタートガイド  |  Firebase

ってゆーかよく見直したらSwift3で似たような記事書いてる。/(^o^)\
【Swift3】と【cocoaPods】と【Firebase】と【adMob】 | iPhoneアプリ備忘録

ただこのあとにpodfileの書き方が変わってる。
【CocoaPods】Podfileの書き方が変わっていた。 | iPhoneアプリ備忘録

それらを参考にPodFileを書き換えます。

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

target 'admobFireBaseTest' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

pod 'Firebase/Core'
pod 'Firebase/AdMob'


  # Pods for admobFireBaseTest

  target 'admobFireBaseTestTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'admobFireBaseTestUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

pod ‘Firebase/Core’
pod ‘Firebase/AdMob’
上記を追加しています。

で、保存したあとターミナルからインストールします。
Podfileのあるディレクトリを間違えないようにね。
で、

$ pod install

結果↓

$ pod install
Analyzing dependencies
Downloading dependencies
Installing Firebase (5.17.0)
Installing FirebaseAnalytics (5.6.0)
Installing FirebaseCore (5.3.0)
Installing FirebaseInstanceID (3.5.0)
Installing Google-Mobile-Ads-SDK (7.40.0)
Installing GoogleAppMeasurement (5.6.0)
Installing GoogleUtilities (5.3.7)
Installing nanopb (0.3.901)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `admobFireBaseTest.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 8 total pods installed.

[!] Automatically assigning platform `ios` with version `12.1` on target `admobFireBaseTest` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

とゆーことでFirebaseとAdMobが入りました。

xcodeでプロジェクトを開くときは、.xcodeprojファイルではなく、
新しく作られた.xcworkspaceファイルを開くことを間違えないようにしましょう。

コメントを残す

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