広告インスペクタを起動する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
広告の統合をテストする前に、アプリで広告インスペクタを起動する必要があります。このページでは、ジェスチャーを使って広告インスペクタを起動する方法と、プログラムで起動する方法について説明します。
前提条件
続行する前に、次の操作を行います。
- AdMob アカウントの作成、テストデバイスの設定、Google Mobile Ads SDK の初期化、最新バージョンのインストールを行い、最初の前提条件のすべての項目を完了します。
起動オプションを選択する
広告インスペクタは次の方法で起動できます。
- テストデバイスを登録したら、AdMob の管理画面で選択したジェスチャーを使用します。詳しくは、テストデバイスを設定するをご覧ください。
- Google Mobile Ads SDK を介してプログラムから起動します。
ジェスチャーを使って起動する
ジェスチャーで広告インスペクタを起動するには、ダブルフリックやシェイクなど、テストデバイス用に AdMob の管理画面で設定したジェスチャーを実行します。詳しくは、広告インスペクタを使用してアプリをテストするをご覧ください。
AdMob の管理画面でジェスチャーを設定したら、変更が反映されるまでしばらく待ちます。Google Mobile Ads SDK を使って広告リクエストを行い、テストデバイスにジェスチャー設定を登録します。ジェスチャーを実行しても広告インスペクタが起動しない場合は、広告を読み込んでからアプリを再起動し、もう一度ジェスチャーをお試しください。
プログラムで起動する
次のコマンドを実行して広告インスペクタを起動します。
Swift
MobileAds.shared.presentAdInspector(from: viewController) { error in
// Error will be non-nil if there was an issue and the inspector was not displayed.
}
Objective-C
[GADMobileAds.sharedInstance presentAdInspectorFromViewController:viewController
completionHandler:^(NSError *error) {
// Error will be non-nil if there was an issue and the inspector was not displayed.
}];
このメソッドは、登録されたテストデバイス(プログラムか AdMob の管理画面を通じて登録)で機能します。詳しくは、テストデバイスを有効にするをご覧ください。
この起動のビュー コントローラが画面に完全に表示されていることを確認します。たとえば、viewDidAppear:
を呼び出した場合です。渡されたビュー コントローラが表示処理の途中の場合(ビュー コントローラ関数 viewDidLoad
で起動が呼び出される場合など)は、広告インスペクタが表示されません。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-05 UTC。
[null,null,["最終更新日 2025-09-05 UTC。"],[],[],null,["Select platform: [Android](/admob/android/ad-inspector/launch-ad-inspector \"View this page for the Android platform docs.\") [iOS](/admob/ios/ad-inspector/launch-ad-inspector \"View this page for the iOS platform docs.\") [Unity](/admob/unity/ad-inspector/launch-ad-inspector \"View this page for the Unity platform docs.\") [Flutter](/admob/flutter/ad-inspector/launch-ad-inspector \"View this page for the Flutter platform docs.\")\n\n\u003cbr /\u003e\n\nBefore you test your ad integration, you must launch ad inspector in your app.\nThis page covers how to launch ad inspector\nusing gestures\nand how to launch\nprogrammatically.\n\nPrerequisites\n\nBefore you continue, do the following:\n\n- Complete all items in the initial [Prerequisites](/admob/ios/ad-inspector#prerequisites) to create an AdMob account, set your test device, initialize Google Mobile Ads SDK, and install the latest version.\n\nChoose a launch option\n\nYou can launch ad inspector in the following ways:\n\n- Use the gesture you selected in the AdMob UI after registering a test device. For details, see [Set up a test device](https://support.google.com/admob/answer/9691433).\n- Programmatically through the Google Mobile Ads SDK.\n\nLaunch using gestures\n\nTo launch ad inspector with a gesture, perform the gesture, such as a double\nflick or shake, that you configured in AdMob UI for your test\ndevice. For more details, see\n[Test your app with ad inspector](https://support.google.com/admob/answer/10159602).\n\nAfter you set a gesture in the AdMob UI, allow time to propagate. Make an ad\nrequest through the Google Mobile Ads SDK to register your\ngesture setting with your test device. If performing your gesture fails to\nopen in ad inspector, try to load an ad, restart your app, and test the gesture\nagain.\n\nLaunch programmatically\n\nLaunch ad inspector by running the following: \n\nSwift \n\n MobileAds.shared.presentAdInspector(from: viewController) { error in\n // Error will be non-nil if there was an issue and the inspector was not displayed.\n }\n\nObjective-C \n\n [GADMobileAds.sharedInstance presentAdInspectorFromViewController:viewController\n completionHandler:^(NSError *error) {\n // Error will be non-nil if there was an issue and the inspector was not displayed.\n }];\n\nThis method works for test devices registered\nprogrammatically or in the AdMob UI.\nFor more details, see\n[Enable test devices](/admob/ios/test-ads#enable_test_devices).\n\nEnsure that the view controller to this launch is fully visible on screen. For\nexample, if you called `viewDidAppear:`. If the view controller passed in is\nin the process to display, such as when the launch is called in the view\ncontroller function `viewDidLoad`, the presentation of the ad inspector fails."]]