While you can use ad inspector to inspect ad behavior during development, testing, and troubleshooting, the tool might increase memory usage when enabled. You might want to disable ad inspector during performance profiling and memory checking. This feature makes sure that ad inspector doesn't run and interfere with your app's performance measurements.
Disabling ad inspector prevents the tool from increasing memory usage or launching through gestures, the debug menu, or method calls. You can disable ad inspector while performance testing in test mode. In production, ad inspector is always disabled and doesn't impact your app's performance.
This guide covers disabling ad inspector and verifying the disablement.
Prerequisites
Before you continue, complete the following:
- Set up Google Mobile Ads SDK.
- Use Google Mobile Ads SDK version 13.8.0 or higher.
Disable with build types
To keep ad inspector available in debug builds while disabling the tool in
profiling builds, manage the build configuration setting by
defining your build settings and updating your Info.plist file.
Complete the following steps:
- In the Xcode navigation menu, select your app from Target.
- In the menu bar, click Build Settings and All.
- Click add.
- From the drop-down menu, select Add User-Defined Setting. A User Defined box appears.
- In the box, add a setting name, for example,
DISABLE_AD_INSPECTOR. - Press ENTER or RETURN. You see a row with your setting name.
- Set your debug and release IDs:
- Expand your setting row. You see the rows Debug and Release.
- Expand the rows and select the following:
- Debug: Yes
- Release: No
- In your
Info.plistfile, add theGADDisableAdInspectorkey with the value as the setting name you created.
If successful, your Info.plist file pulls your test ad unit ID when you select
Run for debug builds, and your ad unit ID after you select Archive
for release builds.
Verify the disablement
When you attempt to open ad inspector while it's disabled, you see the following error message in your log console:
Ad inspector is disabled. Remove GADDisableAdInspector from the plist file to use ad inspector.