Để thảo luận và đưa ra ý kiến phản hồi về các sản phẩm của chúng tôi, hãy tham gia kênh Discord chính thức của Ad Manager trong máy chủ Cộng đồng quảng cáo và đo lường của Google.
Trước khi kiểm thử quá trình tích hợp quảng cáo, bạn phải khởi chạy công cụ kiểm tra quảng cáo trong ứng dụng của mình. Trang này trình bày cách khởi chạy công cụ kiểm tra quảng cáo thông qua trình đơn gỡ lỗi và cách khởi chạy theo phương thức lập trình.
Điều kiện tiên quyết
Trước khi tiếp tục, hãy làm như sau:
Hoàn tất tất cả các mục trong phần Điều kiện tiên quyết ban đầu để tạo tài khoản Ad Manager, thiết lập thiết bị kiểm thử, khởi động SDK Quảng cáo của Google trên thiết bị di động và cài đặt phiên bản mới nhất.
Chọn một lựa chọn phát hành
Bạn có thể khởi chạy công cụ kiểm tra quảng cáo theo những cách sau:
Nút khởi chạy trong trình đơn gỡ lỗi trong ứng dụng của bạn để sử dụng cử chỉ mà bạn đã chọn trong phần cài đặt công cụ kiểm tra quảng cáo.
Theo phương thức lập trình thông qua SDK Quảng cáo của Google trên thiết bị di động.
Khởi chạy bằng trình đơn gỡ lỗi
Để khởi chạy công cụ kiểm tra quảng cáo thông qua trình đơn gỡ lỗi, bạn không cần thực hiện thêm các thay đổi nào trên ứng dụng của mình. Để biết thêm thông tin, hãy xem phần Kiểm tra việc phân phối quảng cáo trên ứng dụng di động.
Hãy hoàn tất các bước sau:
Tìm một quảng cáo được phân phát trong mạng Ad Manager của bạn.
Nhấn và giữ quảng cáo để mở trình đơn gỡ lỗi.
Chọn Mở công cụ kiểm tra quảng cáo.
Nếu không liên kết thiết bị, bạn có thể phải đăng nhập vào tài khoản Ad Manager của mình.
Trong phần cài đặt gỡ lỗi, bạn cũng có thể chọn Cài đặt công cụ kiểm tra quảng cáo và chọn một cử chỉ có thể mở công cụ kiểm tra quảng cáo.
Khởi chạy bằng cách lập trình
Khởi chạy công cụ kiểm tra quảng cáo bằng cách chạy lệnh sau:
Swift
MobileAds.shared.presentAdInspector(from:viewController){errorin// Error will be non-nil if there was an issue and the inspector was not displayed.}
Objective-C
[GADMobileAds.sharedInstancepresentAdInspectorFromViewController:viewControllercompletionHandler:^(NSError*error){// Error will be non-nil if there was an issue and the inspector was not displayed.}];
Phương thức này hoạt động trên những thiết bị thử nghiệm được đăng ký theo phương thức lập trình. Để biết thêm thông tin chi tiết, hãy xem phần Bật thiết bị kiểm thử.
Đảm bảo rằng bộ điều khiển chế độ xem để khởi chạy này hiển thị đầy đủ trên màn hình. Ví dụ: nếu bạn gọi viewDidAppear:. Nếu bộ điều khiển chế độ xem được truyền vào đang trong quá trình hiển thị (chẳng hạn như khi lệnh khởi chạy được gọi trong hàm viewDidLoad của bộ điều khiển chế độ xem), thì công cụ kiểm tra quảng cáo sẽ không hiển thị.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-09-02 UTC."],[],[],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."]]