أخطاء تحميل الإعلانات

عندما يتعذّر تحميل إعلان، يتم استدعاء عملية استدعاء للتعذُّر لتوفير عنصر LoadAdError.

يسترجع مقتطف الرمز التالي معلومات الخطأ عند تعذُّر تحميل إعلان بمكافأة:

onAdFailedToLoad: (ad, loadAdError) {
  // Gets the domain from which the error came.
  String domain = loadAdError.domain;

  // Gets the error code. See
  // https://developers.google.com/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.
  int code = loadAdError.code;

  // A log friendly string summarizing the error.
  String message = loadAdError.message;

  // Get response information, which may include results of mediation requests.
  ResponseInfo? responseInfo = loadAdError.responseInfo;
}

يمكن استخدام هذه المعلومات لتحديد سبب تحميل الإعلان بشكل أكثر دقة. على وجه الخصوص، بالنسبة إلى الأخطاء ضمن النطاق com.google.admob على نظامَي التشغيل iOS وcom.google.android.gms.ads على نظام التشغيل Android، يمكنك البحث عن GetMessage() في مقالة مركز المساعدة هذه للحصول على شرح أكثر تفصيلاً والإجراءات المحتملة التي يمكن اتخاذها لحل المشكلة.