ちなみに以下のサイトがとっても参考になりました。
http://program-life.com/736
手順1:admobサイトで広告IDを発行
手順2:CocoaPodsでSDKインストール
手順3:info.plistの編集
手順4:広告の実装
個人的に手順2がややこしかったので手順をメモしときます。
まず、ターミナルのcdコマンドでプロジェクトのフォルダと同じ階層に移動した後で、以下のコマンドによりCocoaPodsのアップデートをする。
sudo gem install cocoapods
その後、以下のコマンドによりPodfileの雛形を作成する。
pod init
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'ImageProcessing' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for ImageProcessing pod 'Google-Mobile-Ads-SDK' target 'ImageProcessingTests' do inherit! :search_paths # Pods for testing end target 'ImageProcessingUITests' do inherit! :search_paths # Pods for testing end end |
上記、作成した雛形の9行目に広告SDKをインストールする記述を追記して保存したあと、以下のコマンドを実行。
pod install --repo-update
成功すると、ImageProcessing.xcworkspaceファイルが作成され、今後はこのファイルを開いてソースコードを追加していく。
※忘れてはならないのが、info.plistを編集する作業。
ファイル内のInformation Property Listの+を押下して、GADApplicationIdentifierのキーと、値にca-app-pub-****************~**********を追加する。(*は各アプリによってユニークな値)
0 件のコメント:
コメントを投稿