LoginSignup
4
1

More than 5 years have passed since last update.

admobのテスト広告に使うYOUR_SIMULATOR_IDENTIFIERの調べ方

Posted at

YOUR_SIMULATOR_IDENTIFIERがわからない

admobでテスト広告のリクエストを行いたく、ドキュメントを見てみました。
https://developers.google.com/mobile-ads-sdk/docs/admob/additional-controls?hl=ja#ios-test

GADRequest *request = [GADRequest request];

// テスト広告のリクエストを行う。シミュレータと
// テスト広告を表示する端末の識別子を埋め込む。
request.testDevices = [NSArray arrayWithObjects:
                          @"YOUR_SIMULATOR_IDENTIFIER",
                          @"YOUR_DEVICE_IDENTIFIER",
                          nil];

上のようなことが書いてありますが、「YOUR_SIMULATOR_IDENTIFIER」が何かわかりません。

@[ GAD_SIMULATOR_ID ]を使う

プロジェクトを実行して、コンソールを見てみるとこんな表示出ていることに気づきます。

<Google> To get test ads on this device, call: request.testDevices = @[ GAD_SIMULATOR_ID ];

「GAD_SIMULATOR_ID」を使えばいいようです。結果、下のように書けば、シミュレーターで動きます。

//テスト用バナー
    GADRequest *request = [GADRequest request];
    request.testDevices = @[ GAD_SIMULATOR_ID ];

    [bannerView_ loadRequest:request];
4
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1