错误处理
如果广告加载或展示失败,您的广告展示委托或回传接口会收到调用。 该调用带有一个错误代码。 本页介绍了这些错误代码。
错误对象
您在回传中收到的错误是一个实现 MAError 的一等 (first-class) 错误对象。
该对象具有以下 API:
code- 错误代码,见下表。
message- 描述该错误的可读信息。
mediatedNetworkErrorCode- 被聚合平台针对该错误的错误码。 仅适用于广告展示失败回传中返回的错误。
mediatedNetworkErrorMessage- 返回被聚合平台针对该错误的错误信息。 默认为空字符串。 仅适用于广告展示失败回传中返回的错误。
getWaterfall()- Allows you to see the information about the current waterfall for an ad that loads or fails to load. The network responses provide the ad load state, latency, credentials, and mediated network information for each ad in the waterfall. If an ad in the waterfall fails to load, the network response provides error information. You can learn more about this method in Advanced Settings: Waterfall Information API.
MAX 错误代码
| 代码 | 常量 | 描述 | Load / Display |
|---|---|---|---|
| -1 | MAErrorCodeUnspecified | The system is in an unexpected state. This error code represents an error that MAX could categorize into one of the other defined errors. See the message field in the error object for more details. | L/D |
| 204 | MAErrorCodeNoFill | No ads are eligible for your device (no fill). MAX returned no eligible ads from any mediated networks for this app/device. | L |
| -5001 | MAErrorCodeAdLoadFailed | The ad failed to load because no networks can fill. MAX returned eligible ads from mediated networks, but all ads failed to load. Inspect -[MAError waterfall] for more details. | L |
| -1000 | MAErrorCodeNetworkError | 由于一般网络错误,广告请求失败。请查看错误对象中的消息字段,了解更多详情。 | L |
| -1001 | MAErrorCodeNetworkTimeout | 由于网速较慢,广告请求超时。 | L |
| -1009 | MAErrorCodeNoNetwork | 设备未连接至互联网,广告请求失败。 | L |
| -23 | MAErrorCodeFullscreenAdAlreadyShowing | 您尝试展示一则全屏广告 (插屏广告或激励广告),但另一则全屏广告仍在展示。 | D |
| -24 | MAAdapterError.adNotReady | 您试图在全屏广告加载完成之前展示该广告。 | D |
| -5205 | MAAdapterError.adNotReady | 适配器在尝试展示时没有已准备好的广告。 | L |
| -5209 | MAAdapterError.internalError | 未指明的内部错误。 | L |
| -5603 | MAErrorCodeInvalidAdUnitIdentifier | The SDK failed to load an ad because the publisher provided an invalid ad unit identifier. Possible reasons for an invalid ad unit identifier:
| L |
不同平台的错误代码
To better understand the error codes that ad networks return, see the error documentation pages published by those networks: