Gdy nie uda się wczytać reklamy, wywoływane jest wywołanie zwrotne dotyczące błędu, które udostępnia obiekt LoadAdError.
Poniższy fragment kodu pobiera informacje o błędzie, gdy nie uda się wczytać reklamy:
publicvoidOnAdFailedToLoad(LoadAdErrorerror){// Gets the domain from which the error came.stringdomain=error.GetDomain();// Gets the error code. See// https://developers.google.com/admob/android/reference/com/google/android/gms/ads/AdRequest// and https://developers.google.com/admob/ios/api/reference/Enums/GADErrorCode// for a list of possible codes.intcode=error.GetCode();// Gets an error message.// For example "Account not approved yet". See// https://support.google.com/admob/answer/9905175 for explanations of// common errors.stringmessage=error.GetMessage();// Gets the cause of the error, if available.AdErrorunderlyingError=error.GetCause();// All of this information is available through the error's toString() method.Debug.Log("Load error string: "+error.ToString());// Get response information, which may include results of mediation requests.ResponseInforesponseInfo=error.GetResponseInfo();Debug.Log("Response info: "+responseInfo.ToString());}
Te informacje mogą pomóc w dokładniejszym określeniu przyczyny niepowodzenia wczytania reklamy. W szczególności w przypadku błędów w domenie com.google.admob w
iOS i com.google.android.gms.ads w Androidzie można wyszukać GetMessage() w tym artykule w Centrum pomocy, aby uzyskać bardziej szczegółowe
wyjaśnienie i możliwe działania, które można podjąć w celu rozwiązania problemu.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2026-05-31 UTC."],[],["When an ad fails to load, the `LoadAdError` object provides details via a callback. Key actions include retrieving the error's domain using `GetDomain()`, the error code with `GetCode()`, and a descriptive message via `GetMessage()`. The underlying cause is accessible with `GetCause()`. All data is also in the `ToString()` method. `GetResponseInfo()` offers insights, possibly regarding mediation. `GetMessage()` can be researched in a specific article to resolve the cause of the ad loading failure.\n"]]