啟動廣告檢查器
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
測試廣告整合功能前,請務必在應用程式中啟動廣告檢查器。
本頁分別說明如何透過偵錯選單,以及如何以程式輔助方式啟動廣告檢查器。
必要條件
繼續操作前,請先執行下列工作:
- 完成初始「必要條件」列出的所有項目:建立 Ad Manager 帳戶、設定測試裝置、初始化 Google Mobile Ads SDK,以及安裝最新版本。
選擇啟動方式
您可以透過下列方式啟動廣告檢查器:
- 點按應用程式偵錯選單的啟動按鈕,使用您在廣告檢查器設定中選取的手勢。
- 透過 Google Mobile Ads SDK 以程式輔助方式啟動。
如要透過偵錯選單啟動廣告檢查器,則不需對應用程式進行任何變更。詳情請參閱「檢查行動應用程式廣告放送情形」。
操作步驟如下:
- 找出在 Ad Manager 聯播網放送的廣告。
- 按住廣告即可開啟偵錯選單。
- 選取「Open ad inspector」。
如果沒有連結裝置,可能需要登入 Ad Manager 帳戶。
您也可以在偵錯設定中選取「Ad inspector settings」,然後選擇開啟廣告檢查器的手勢。
以程式輔助方式啟動
執行下列指令,啟動廣告檢查器:
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.
}];
這個方法適用於以程式輔助方式註冊的測試裝置。詳情請參閱「啟用測試裝置」。
請確保啟動的檢視畫面控制器完全顯示在螢幕上。舉例來說,如果您呼叫 viewDidAppear:
,如果傳入的檢視區塊控制器正在顯示中 (例如在檢視區塊控制器函式 viewDidLoad
中呼叫啟動),廣告檢查器就無法顯示。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-02 (世界標準時間)。
[null,null,["上次更新時間:2025-09-02 (世界標準時間)。"],[],[],null,["Select platform: [Android](/ad-manager/mobile-ads-sdk/android/ad-inspector/launch-ad-inspector \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/ad-inspector/launch-ad-inspector \"View this page for the iOS platform docs.\") [Unity](/ad-manager/mobile-ads-sdk/unity/ad-inspector/launch-ad-inspector \"View this page for the Unity platform docs.\") [Flutter](/ad-manager/mobile-ads-sdk/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\nthrough the debug menu and how to launch\nprogrammatically.\n\nPrerequisites\n\nBefore you continue, do the following:\n\n- Complete all items in the initial [Prerequisites](/ad-manager/mobile-ads-sdk/ios/ad-inspector#prerequisites) to create an Ad Manager 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- The launch button from the debug menu within your app to use the gesture that you selected in the ad inspector settings.\n- Programmatically through the Google Mobile Ads SDK.\n\nLaunch using the debug menu\n\nTo launch ad inspector through the debug menu, you don't require further\nchanges on your app. For more details, see\n[Inspect mobile app ad delivery](//support.google.com/admanager/answer/7180401).\n\nComplete the following steps:\n\n1. Find an ad served in your Ad Manager network.\n2. Touch and hold the ad to open the debug menu.\n3. Select **Open ad inspector**.\n\nIf you didn't [link your device](/ad-manager/mobile-ads-sdk/ios/debug#link_your_device), you might\nneed to sign in to your Ad Manager account.\n\nFrom the debug settings, you can also select **Ad inspector settings** and\nchoose a gesture that can open ad inspector.\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 programmatically. For more details, see\n[Enable test devices](/ad-manager/mobile-ads-sdk/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."]]