AdResult 객체는 광고 로드 시도 실패를 감지하는 메커니즘을 제공합니다.
실패가 발생하면 AdResult 메서드 is_successful()가 false를 반환합니다.
이러한 상황에서 AdResult 메서드 ad_error()를 호출하면 오류와 관련된 정보가 포함된 AdError 객체가 반환됩니다.
다음은 광고를 로드하지 못했을 때 제공될 수 있는 정보를 보여주는 코드 스니펫입니다.
firebase::Future<firebase::gma::AdResult>load_ad_future=ad_view->LoadAd(request);// In a game loop, monitor the load ad statusif(load_ad_future.status()==firebase::kFutureStatusComplete){constfirebase::gma::AdResult*ad_result=load_ad_future.result();if(!ad_result.is_successful()){// There was an error loading the ad.constAdError&ad_error=ad_result.ad_error();firebase::gma::AdErrorCodecode=ad_error.code();std::stringdomain=ad_error.domain();std::stringmessage=ad_error.message();constfirebase::gma::ResponseInforesponse_info=ad_error.response_info();printf("Received error with domain: %s, code: %d, message: %s and response info: %s\n”,domain.c_str(),message.c_str(),response_info.ToString().c_str());}}
이 정보를 사용하여 광고를 로드하지 못한 원인을 보다 정확하게 파악할 수 있습니다. 특히, iOS의 경우 com.google.admob 도메인, Android의 경우 com.google.android.gms.ads 도메인에서 오류가 발생하면 이 고객센터 도움말에서 메시지를 검색하여 자세한 설명 및 문제 해결을 위해 취할 수 있는 조치에 대해 알아볼 수 있습니다.
[null,null,["최종 업데이트: 2025-02-23(UTC)"],[[["The Google Mobile Ads C++ SDK is deprecated and will be end-of-maintenance on June 17, 2025, with iOS and Android SDKs recommended as alternatives."],["Developers should use `AdResult` objects, specifically the `is_successful()` and `ad_error()` methods, to detect and diagnose ad loading failures."],["`AdError` objects provide detailed error information, including domain, code, and message, for troubleshooting failed ad loads."],["Error messages can be cross-referenced with the Google AdMob help center to identify the root cause and potential solutions."]]],["The Google Mobile Ads C++ SDK is deprecated as of June 17, 2024, and will reach End-of-Maintenance on June 17, 2025. AdMob iOS and Android SDKs are recommended alternatives. `AdResult` objects detect failed ad loads; `is_successful()` indicates success, and `ad_error()` retrieves an `AdError` object for failures. The `AdError` includes error domain, code, message, and response info, which can be used to troubleshoot. Refer to the Google help center for specific error resolutions.\n"]]