تتناول هذه الصفحة عمليات نقل البيانات للإصدارات الحالية والسابقة من Google Mobile Ads SDK لنظام التشغيل iOS. نتوقّع طرح الإصدار 13.0.0 في فبراير 2026.
نقل البيانات من الإصدار 12 إلى الإصدار 13
زيادة الحد الأدنى لإصدار نظام التشغيل المستهدَف
تم رفع الحد الأدنى لإصدار نظام التشغيل المستهدَف إلى iOS 13.
تغييرات على واجهات برمجة التطبيقات الخاصة بحجم "إعلانات البانر التكيُّفية الثابتة"
يؤدي الإصدار 13.0.0 إلى إيقاف واجهات برمجة التطبيقات الحالية الخاصة بحجم "إعلانات البانر التكيُّفية الثابتة" نهائيًا، ويقدّم واجهات برمجة تطبيقات خاصة بحجم "إعلانات البانر التكيُّفية الثابتة الكبيرة". يمكن لـ "Google Mobile Ads SDK" عرض إعلانات الفيديو على "إعلانات البانر" باستخدام واجهات برمجة التطبيقات الجديدة الخاصة بحجم "إعلانات البانر التكيُّفية الثابتة الكبيرة".
يوضّح الجدول التالي واجهات برمجة التطبيقات المتوقّفة نهائيًا لتحديد الحجم وبدائلها:
| الإصدار 12 (متوقّف نهائيًا) | الإصدار 13 (بديل) |
|---|---|
GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width) |
GADLargeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width) |
GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width) |
GADLargeLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width) |
GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width) |
GADLargePortraitAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width) |
مواصلة دعم التزامن في Swift 6
يواصل الإصدار 13.0.0 إضافة ميزات التوافق مع ميزة التزامن الصارم في Swift 6.
تمت إضافة إجراءات تنفيذ أكثر صرامة لنوع مصفوفة neighboringContentURLStrings
بدءًا من الإصدار 13.0.0، يعرض Google Mobile Ads SDK استثناءً في حال رصد عنصر ليس من نوع String في مصفوفة neighboringContentURLStrings.
نقل البيانات من الإصدار 11 إلى الإصدار 12
الترقية إلى الإصدار 16.0 من Xcode
تمت زيادة الحد الأدنى لإصدار Xcode المتوافق إلى 16.0.
التوافق مع تسمية Swift
يتضمّن الإصدار 12.0.0 تغييرات لاتباع اصطلاحات التسمية في إرشادات تصميم واجهة برمجة التطبيقات في Swift. تؤثر هذه التغييرات في Swift فقط. لم يتم إجراء أي تغييرات على أسماء واجهات برمجة التطبيقات في Objective-C.
تغييرات في بادئة الصف
تم إجراء التغييرات التالية على بادئات الفئات:
- تمت إزالة البادئة
GADمن الأسماء لجميع الأنواع. - تمت إعادة تسمية البادئة
GAMإلىAdManager. - تمت إعادة تسمية البادئة
GADMإلىMediation.
إصلاح الأخطاء
إنّ أفضل طريقة لحلّ الأخطاء الناتجة عن هذه التغييرات هي إجراء تصحيح باستخدام ميزة "تصحيح".
حلّ التعارضات في الأسماء
لحلّ التعارضات في الأسماء، استخدِم مساحة الاسم التي توفّرها الوحدة. على سبيل المثال، تم تغيير اسم "GADRequest" إلى "Request". في المثال التالي، يتم تحديد مساحة الاسم
Google Mobile Ads SDK Request class:
import GoogleMobileAds
...
var request: GoogleMobileAds.Request?
قائمة مفصّلة بالتغييرات في Swift
تسرد الجداول التالية التغييرات التي تم إجراؤها على واجهات برمجة التطبيقات Swift API:
| الإصدار 11 | الإصدار 12 |
|---|---|
GADAdapterInitializationState |
AdapterInitializationState |
GADAdChoicesPosition |
AdChoicesPosition |
GADAdChoicesView |
AdChoicesView |
GADAdFormat |
AdFormat |
GADAdLoader |
AdLoader |
GADAdLoaderAdType |
AdLoaderAdType |
GADAdLoaderDelegate |
AdLoaderDelegate |
GADAdMetadataDelegate |
AdMetadataDelegate |
GADAdMetadataProvider |
AdMetadataProvider |
GADAdNetworkExtras |
AdNetworkExtras |
GADAdNetworkResponseInfo |
AdNetworkResponseInfo |
GADAdReward |
AdReward |
GADAdSize |
AdSize |
GADAdSizeDelegate |
AdSizeDelegate |
GADAdValue |
AdValue |
GADAdValuePrecision |
AdValuePrecision |
GADAppEventDelegate |
AppEventDelegate |
GADAppOpenAd |
AppOpenAd |
GADAppOpenSignalRequest |
AppOpenSignalRequest |
GADAudioVideoManager |
AudioVideoManager |
GADAudioVideoManagerDelegate |
AudioVideoManagerDelegate |
GADBannerSignalRequest |
BannerSignalRequest |
GADBannerView |
BannerView |
GADBannerViewDelegate |
BannerViewDelegate |
GADCustomEventExtras |
CustomEventExtras |
GADCustomEventRequest |
CustomEventRequest |
GADCustomNativeAd |
CustomNativeAd |
GADCustomNativeAdLoaderDelegate |
CustomNativeAdLoaderDelegate |
GADCustomNativeAdDelegate |
CustomNativeAdDelegate |
GADDebugOptionsViewControllerDelegate |
DebugOptionsViewControllerDelegate |
GADDebugOptionsViewController |
DebugOptionsViewController |
GADDisplayAdMeasurement |
DisplayAdMeasurement |
GADExtras |
Extras |
GADFullScreenPresentingAd |
FullScreenPresentingAd |
GADFullScreenContentDelegate |
FullScreenContentDelegate |
GADAdapterStatus |
AdapterStatus |
GADInitializationStatus |
InitializationStatus |
GADInterstitialAd |
InterstitialAd |
GADInterstitialSignalRequest |
InterstitialSignalRequest |
GADMediaAspectRatio |
MediaAspectRatio |
GADMediaContent |
MediaContent |
GADMediaView |
MediaView |
GADMobileAds |
MobileAds |
GADMultipleAdsAdLoaderOptions |
MultipleAdsAdLoaderOptions |
GADMuteThisAdReason |
MuteThisAdReason |
GADNativeAd |
NativeAd |
GADNativeAdLoaderDelegate |
NativeAdLoaderDelegate |
GADNativeAdView |
NativeAdView |
GADNativeAdCustomClickGestureOptions |
NativeAdCustomClickGestureOptions |
GADNativeAdDelegate |
NativeAdDelegate |
GADNativeAdImage |
NativeAdImage |
GADNativeAdImageAdLoaderOptions |
NativeAdImageAdLoaderOptions |
GADNativeAdInlineBehavior |
NativeAdInlineBehavior |
GADNativeAdInlineBehaviorOptions |
NativeAdInlineBehaviorOptions |
GADNativeAdMediaAdLoaderOptions |
NativeAdMediaAdLoaderOptions |
GADNativeAdUnconfirmedClickDelegate |
NativeAdUnconfirmedClickDelegate |
GADNativeAdViewAdOptions |
NativeAdViewAdOptions |
GADNativeMuteThisAdLoaderOptions |
NativeMuteThisAdLoaderOptions |
GADNativeSignalRequest |
NativeSignalRequest |
GADPresentationError |
PresentationError |
GADPublisherPrivacyPersonalizationState |
PublisherPrivacyPersonalizationState |
GADQueryInfo |
QueryInfo |
GADRequest |
Request |
GADRequestError |
RequestError |
GADRequestConfiguration |
RequestConfiguration |
GADResponseInfo |
ResponseInfo |
GADRewardedAd |
RewardedAd |
GADRewardedSignalRequest |
RewardedSignalRequest |
GADRewardedInterstitialAd |
RewardedInterstitialAd |
GADRewardedInterstitialSignalRequest |
RewardedInterstitialSignalRequest |
GADSearchBannerView |
SearchBannerView |
GADServerSideVerificationOptions |
ServerSideVerificationOptions |
GADSignal |
Signal |
GADSignalRequest |
SignalRequest |
GADVersionNumber |
VersionNumber |
GADVideoController |
VideoController |
GADVideoControllerDelegate |
VideoControllerDelegate |
| إدارة إعلانات Google | |
GAMBannerAdLoaderDelegate |
AdManagerBannerAdLoaderDelegate |
GAMBannerView |
AdManagerBannerView |
GAMBannerViewOptions |
AdManagerBannerViewOptions |
GAMInterstitialAd |
AdManagerInterstitialAd |
GAMRequest |
AdManagerRequest |
| الوساطة | |
GADMAdNetworkAdapter |
MediationAdNetworkAdapter |
GADMAdNetworkConnector |
MediationAdNetworkConnector |
GADMBannerAnimationType |
MediationBannerAnimationType |
GADMediatedUnifiedNativeAd |
MediationUnifiedNativeAd |
GADMediatedUnifiedNativeAdNotificationSource |
MediationUnifiedNativeAdNotificationSource |
GADMediationAd |
MediationAd |
GADMediationAdConfiguration |
MediationAdConfiguration |
GADMediationAdEventDelegate |
MediationAdEventDelegate |
GADMediationAdRequest |
MediationAdRequest |
GADMediationAdapter |
MediationAdapter |
GADMediationAppOpenAd |
MediationAppOpenAd |
GADMediationAppOpenAdEventDelegate |
MediationAppOpenAdEventDelegate |
GADMediationBannerAd |
MediationBannerAd |
GADMediationBannerAdConfiguration |
MediationBannerAdConfiguration |
GADMediationBannerAdEventDelegate |
MediationBannerAdEventDelegate |
GADMediationCredentials |
MediationCredentials |
GADMediationInterstitialAd |
MediationInterstitialAd |
GADMediationInterstitialAdConfiguration |
MediationInterstitialAdConfiguration |
GADMediationInterstitialAdEventDelegate |
MediationInterstitialAdEventDelegate |
GADMediationNativeAd |
MediationNativeAd |
GADMediationNativeAdConfiguration |
MediationNativeAdConfiguration |
GADMediationNativeAdEventDelegate |
MediationNativeAdEventDelegate |
GADMediationRewardedAd |
MediationRewardedAd |
GADMediationRewardedAdConfiguration |
MediationRewardedAdConfiguration |
GADMediationRewardedAdEventDelegate |
MediationRewardedAdEventDelegate |
GADMediationServerConfiguration |
MediationServerConfiguration |
| عرض أسعار الوقت الفعلي | |
GADRTBAdapter |
RTBAdapter |
GADRTBMediationSignalsConfiguration |
RTBMediationSignalsConfiguration |
GADRTBRequestParameters |
RTBRequestParameters |
الثوابت
| الإصدار 11 | الإصدار 12 |
|---|---|
GADAdLoaderAdType.gamBanner |
AdLoaderAdType.adManagerBanner |
GADAdSizeBanner |
AdSizeBanner |
GADAdSizeFluid |
AdSizeFluid |
GADAdSizeFullBanner |
AdSizeFullBanner |
GADAdSizeInvalid |
AdSizeInvalid |
GADAdSizeLargeBanner |
AdSizeLargeBanner |
GADAdSizeLeaderboard |
AdSizeLeaderboard |
GADAdSizeMediumRectangle |
AdSizeMediumRectangle |
GADAdSizeSkyscraper |
AdSizeSkyscraper |
GoogleMobileAdsVersionString |
GoogleMobileAdsVersion |
الخصائص
| النوع | الإصدار 11 | الإصدار 12 |
|---|---|---|
| GADAdLoader | loading |
isLoading |
| GADAudioVideoManager | audioSessionApplicationManaged |
isAudioSessionApplicationManaged |
| GADBannerView | autoloadEnabled |
isAutoloadEnabled |
| GADMobileAds | sharedInstance |
shared |
applicationMuted |
isApplicationMuted |
|
| GADMuteThisAdReason | reasonDescription |
reason |
| GADNativeAd | customMuteThisAdAvailable |
isCustomMuteThisAdAvailable |
| GADNativeAdCustomClickGestureOptions | tapsAllowed |
areTapsAllowed |
| GADNativeAdImageAdLoaderOptions | imageLoadingDisabled |
isImageLoadingDisabled |
| GADNativeMuteThisAdLoaderOptions | customMuteThisAdRequested |
isCustomMuteThisAdRequested |
| GADNativeSignalRequest | imageLoadingDisabled |
isImageLoadingDisabled |
customMuteThisAdRequested |
isCustomMuteThisAdRequested |
|
| GADRequest | neighboringContentURLStrings |
neighboringContentURLs |
| GADResponseInfo | extrasDictionary |
extras |
| GADServerSideVerificationOptions | customRewardString |
customRewardText |
| GADSignal | signalString |
signal |
| GADSignalRequest | neighboringContentURLStrings |
neighboringContentURLs |
| GADVideoController | customControlsRequested |
areCustomControlsRequested |
clickToExpandEnabled |
isClickToExpandEnabled |
|
| GADVideoOptions | startMuted |
shouldStartMuted |
customControlsRequested |
areCustomControlsRequested |
|
clickToExpandRequested |
isClickToExpandRequested |
الدوال
| النوع | الإصدار 11 | الإصدار 12 |
|---|---|---|
| GADAdSize | GADPortraitInlineAdaptiveBannerAdSizeWithWidth(_:) |
portraitInlineAdaptiveBanner(width:) |
GADLandscapeInlineAdaptiveBannerAdSizeWithWidth(_:) |
landscapeInlineAdaptiveBanner(width:) |
|
GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(_:) |
currentOrientationInlineAdaptiveBanner(width:) |
|
GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(_:, _:) |
inlineAdaptiveBanner(width:maxHeight:) |
|
GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(_:) |
portraitAnchoredAdaptiveBanner(width:) |
|
GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(_:) |
landscapeAnchoredAdaptiveBanner(width:) |
|
GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(_:) |
currentOrientationAnchoredAdaptiveBanner(width:) |
|
GADAdSizeFromCGSize(_:) |
adSizeFor(cgSize:) |
|
GADAdSizeFullWidthPortraitWithHeight(_:) |
fullWidthPortrait(height:) |
|
GADAdSizeFullWidthLandscapeWithHeight(_:) |
fullWidthLandscape(height:) |
|
GADAdSizeEqualToSize(_:, _:) |
isAdSizeEqualToSize(size1:size2:) |
|
IsGADAdSizeValid(_:) |
isAdSizeValid(size:) |
|
GADAdSizeIsFluid(_:) |
isAdSizeFluid(size:) |
|
CGSizeFromGADAdSize(_:) |
cgSize(for:) |
|
NSStringFromGADAdSize(_:) |
string(for:) |
|
NSValueFromGADAdSize(_:) |
nsValue(for:) |
|
GADAdSizeFromNSValue(_:) |
adSizeFor(nsValue:) |
|
GADClosestValidSizeForAdSizes(_:_:) |
closestValidSizeForAdSizes(original:possibleAdSizes:) |
|
| GADAppEventDelegate | adView(_:didReceiveAppEvent:withInfo:) |
adView(_:didReceiveAppEvent:with:) |
interstitialAd(_:didReceiveAppEvent:withInfo:) |
adView(_:didReceiveAppEvent:with:) |
|
| GADAppOpenAd | load(withAdResponseString:) |
load(with:) |
load(withAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
|
canPresent(fromRootViewController:) |
canPresent(from:) |
|
present(fromRootViewController:) |
present(from:) |
|
| GADBannerView | load(withAdResponseString:) |
load(with:) |
| GADInterstitial | load(withAdResponseString:) |
load(with:) |
load(withAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
|
canPresent(fromRootViewController:) |
canPresent(from:) |
|
present(fromRootViewController:) |
present(from:) |
|
| GADRewardedAd | load(withAdResponseString:) |
load(with:) |
load(withAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
|
canPresent(fromRootViewController:) |
canPresent(from:) |
|
present(fromRootViewController:userDidEarnRewardHandler:) |
present(from:userDidEarnRewardHandler:) |
|
| GADRewardedInterstitialAd | load(withAdResponseString:) |
load(with:) |
load(withAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
|
canPresent(fromRootViewController:) |
canPresent(from:) |
|
present(fromRootViewController:userDidEarnRewardHandler:) |
present(from:userDidEarnRewardHandler:) |
|
| GADVersionNumber | GADGetStringFromVersionNumber(_ version: GADVersionNumber) |
string(for:) |
| الوساطة | ||
| GADMAdNetworkAdapter | getBannerWith(_:) |
getBanner(with:) |
presentInterstitial(fromRootViewController:) |
presentInterstitial(from:) |
|
getNativeAd(withAdTypes:options:) |
getNativeAd(with:options:) |
|
| GADMediatedUnifiedNativeAd | didRecordClickOnAsset(withName:view:viewController:) |
didRecordClickOnAsset(with:view:viewController:) |
| GADMediationAdapter | setUpWith(_:completionHandler:) |
setUp(with:completionHandler:) |
| GADMediationAdSize | present(fromRootViewController:) |
present(from:) |
| GADMediationAppOpenAd | present(fromRootViewController:) |
present(from:) |
| GADMediationInterstitialAd | present(fromRootViewController:) |
present(from:) |
| GADMediationRewardedAd | present(fromRootViewController:) |
present(from:) |
| GAMInterstitialAd | load(withAdManagerAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
ضبط مَعلمات الاستهداف المخصّصة
لضبط استهداف مخصّص في طلب عرض الإعلان، استخدِم
customTargeting.
تغييرات في واجهة برمجة التطبيقات للتحكّم في حالة كتم صوت الفيديو
تم استبدال السمة isMuted والطريقة setMute: في GADVideoController بالسمة muted.
التغييرات على "إعلانات البانر التكيُّفية المضمّنة"
لتحسين استخدام المساحة، لا تشغل "الإعلانات التكيُّفية" المضمّنة في البداية أي مساحة في الإطار. يؤدي استدعاء CGSizeFromGADAdSize(_:) مع حجم إعلان تكيُّفي مضمّن الآن إلى عرض ارتفاع 0 إلى أن تعرض حزمة SDK لإعلانات Google على الأجهزة الجوّالة إعلانًا.
تمت إزالة إعلانات البحث المخصّص
تمت إزالة الفئات التالية بدون استبدالها:
GADDynamicHeightSearchBannerViewGADDynamicHeightSearchRequestGADSearchBannerView
التغييرات في رموز الخطأ
تم تغيير رموز الخطأ التالية:
| الفئة | ملاحظات |
|---|---|
GADErrorMediationNoFill |
تظهر الأخطاء الآن على شكل GADErrorNoFill. |
GADErrorReceivedInvalidResponse |
تم استبدالها بـ GADErrorReceivedInvalidAdString. |
تمت إزالة GADSimulatorID
تمت إزالة GADSimulatorID. تكون المحاكيات في وضع الاختبار تلقائيًا.
التغييرات في الاستهداف المخصّص
يستخدم قاموس "customTargeting" في "GADRequest" الآن "Any" بدلاً من
"String" كنوع القيمة. يتيح لك ذلك تمرير قيم رقمية إلى واجهة برمجة التطبيقات.
التغييرات على مَعلمات الإضافات
- لم يعد تمرير المفاتيح إلى
additionalParametersيطبّق الاستهداف المخصّص على طلبات عرض الإعلانات في "مدير إعلانات Google". لتطبيق الاستهداف المخصّص، يُرجى الاطّلاع على الاستهداف المخصّص.
- لم يعُد من الممكن تمرير مفتاح
max_ad_content_ratingإلىadditionalParameters. لضبط التقييم الأقصى للمحتوى الإعلاني، يُرجى الاطّلاع على مقالة فلترة محتوى الإعلان.
نقل البيانات من الإصدار 10 إلى الإصدار 11
الحدّ الأدنى لإصدار نظام التشغيل المستهدَف
تم رفع الحد الأدنى لإصدار نظام التشغيل المستهدَف إلى iOS 12.
الحدّ الأدنى لإصدار Xcode
تم رفع الحد الأدنى لإصدار Xcode المتوافق إلى 15.1.
توقُّف عرض الإعلانات على الإصدار 12 من نظام التشغيل iOS
يعرض الإصدار 11.0.0 من "Google Mobile Ads SDK" الإعلانات فقط على الأجهزة التي تعمل بالإصدار 13 من نظام التشغيل iOS والإصدارات الأحدث.
تمت إزالة تبعية GoogleAppMeasurement
في الإصدار 11.0.0، تمت إزالة الاعتمادية على
GoogleAppMeasurement. سيتم إيقاف هذه التبعية التي شغّلت مفتاح تبديل "مقاييس سلوك المستخدمين" في AdMob نهائيًا في أوائل العام 2024. لمواصلة جمع مقاييس سلوك المستخدمين في AdMob، عليك ربط تطبيقك على AdMob بمنصة Firebase ودمج حزمة تطوير البرامج (SDK) الخاصة بإصدار "إحصاءات Google لبرنامج Firebase" في تطبيقك.
تغييرات على عرض الإعلانات بملء الشاشة
تؤثر التغييرات التالية في أشكال الإعلانات المختلفة:
- إعلان على شاشة فتح التطبيق
- إعلان بيني
- تمت المكافأة
- إعلان بيني مقابل مكافأة
مَعلمة وحدة التحكّم في العرض في -canPresentFromRootViewController:error: و-presentFromRootViewController: يمكن أن تكون فارغة. في حال تمرير قيمة فارغة، يتم عرض الإعلان من وحدة التحكّم في العرض الأعلى في التسلسل الهرمي لوحدات التحكّم في العرض.
تمت إزالة الطرق
تمت إزالة الطرق التالية.
| نوع الإصدار 11.0.0 | الطريقة | ملاحظات |
|---|---|---|
| GADAppOpenAd | load(withAdUnitID adUnitID: String, request: GADRequest?, orientation: UIInterfaceOrientation) |
يمكنك استخدام load(withAdUnitID adUnitID: String, request: GADRequest?) كبديل. |
| GADMediationBannerAdEventDelegate | willBackgroundApplication() |
لا يتم استبدالها. |
| GADMediationInterstitialAdEventDelegate | willBackgroundApplication() |
لا يتم استبدالها. |
| GADMediationNativeAdEventDelegate | willBackgroundApplication() |
لا يتم استبدالها. |
| GADMediationRewardedAdEventDelegate | didRewardUser(with reward: GADAdReward) |
يمكنك استخدام didRewardUser() كبديل. |
| GADMediatedUnifiedNativeAdNotificationSource | mediatedNativeAdWillLeaveApplication(_ mediatedNativeAd: GADMediatedUnifiedNativeAd) |
لا يتم استبدالها. |
| GADRequestConfiguration | setSameAppKeyEnabled(_ enabled: Bool) |
يمكنك استخدام setPublisherFirstPartyIDEnabled(_ enabled: Bool) كبديل. |
tagForUnderAge(ofConsent underAgeOfConsent: Bool) |
استخدِم السمة tagForUnderAgeOfConsent بدلاً من ذلك. |
|
tag(forChildDirectedTreatment childDirectedTreatment: Bool) |
استخدِم السمة tagForChildDirectedTreatment بدلاً من ذلك. |
المواقع التي تمت إزالتها
تمت إزالة السمات التالية.
| فئة الإصدار 11.0.0 | الموقع | ملاحظات |
|---|---|---|
| GADMediationAdConfiguration | hasUserLocation | لا يتم استبدالها. |
| userLatitude | ||
| userLongitude | ||
| userLocationAccuracyInMeters | ||
| childDirectedTreatment | يمكنك استخدام GADMobileAds.sharedInstance.requestConfiguration.tagForChildDirectedTreatment كبديل. |
|
| GADResponseInfo | adNetworkClassName | يمكنك استخدام adNetworkClassName من loadedAdNetworkResponseInfo بدلاً من ذلك. |
تمت إزالة GADAdFormatUnknown
تمت إزالة GADAdFormatUnknown بدون استبدال.
تغييرات في تسجيل إصدار حزمة SDK
يؤدي الإصدار 11.0.0 إلى إزالة sdkVersion. لتسجيل إصدار Google Mobile Ads SDK،
يُرجى استخدام versionNumber
بدلاً من ذلك.
الإصدار 10.0.0
GADMobileAds.sharedInstance().sdkVersion
الإصدار 11.0.0
GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)
تغييرات على معالجة أخطاء GADAdLoader
اعتبارًا من الإصدار 11.0.0، لا تُرسل حزمة تطوير البرامج (SDK) لـ "GADAdLoader" طلب عرض إعلان إذا لم يتوافق
delegate
مع بروتوكول التفويض لأنواع الإعلانات المطلوبة. في السابق، كان يتعذّر تحميل الإعلان
بعد إرسال طلب عرض الإعلان.
التغييرات على سلوك الاختبار
يُرجى الاطّلاع على الجدول الذي يعرض الشروط المعدَّلة للحالات التي تعرض فيها السمات التالية القيمة true.
| الفئة | الموقع |
|---|---|
| GADMediationAdConfiguration | isTestRequest |
| GADCustomEventRequest | isTesting |
| v10.0.0 | v11.0.0 |
|
|
نقل البيانات من الإصدار 9 إلى الإصدار 10
توقُّف عرض الإعلانات على نظام التشغيل iOS 11
يعرض الإصدار 10.0.0 من "Google Mobile Ads SDK" الإعلانات فقط على الأجهزة التي تعمل بنظام التشغيل iOS 12 والإصدارات الأحدث.
لن تؤدي الترقية إلى الإصدار 10.0.0 من "Google Mobile Ads SDK" إلى تعطيل تطبيقك على الأجهزة التي تعمل بنظامَي التشغيل iOS 11 وiOS 10، ولكن لن يتم عرض أي إعلانات على هذه الأجهزة.
متطلبات رقم تعريف تطبيق "إدارة إعلانات Google"
أصبح رقم تعريف تطبيق "مدير الإعلانات" مطلوبًا الآن في Info.plist لجميع تطبيقات "مدير الإعلانات"،
ويجب أن يكون بالتنسيق ca-app-pub-################~##########. لمزيد من التفاصيل، يُرجى الاطّلاع على تعديل ملف Info.plist.
متطلبات GoogleAppMeasurement.xcframework
أصبح GoogleAppMeasurement.xcframework مطلوبًا الآن لجميع تطبيقات "مدير إعلانات Google". إذا ثبّتّ "Google Mobile Ads SDK" من خلال Cocoapods أو Swift Package Manager، ليس عليك اتّخاذ أي إجراء إضافي. إذا كنت تثبّت أُطر العمل يدويًا، يمكنك الاطّلاع على التنزيل اليدوي لمزيد من التفاصيل.
لم يعُد إنشاء التطبيقات باستخدام رمز بت متاحًا
يجب الآن إيقاف رمز بت في تطبيقاتك المتوافقة مع الأجهزة الجوّالة لدمج Google Mobile Ads SDK.
الأنواع التي تمت إزالتها
| النوع | ملاحظات |
|---|---|
| GADGender | لا يتم استبدالها. |
| GADMRewardBasedVideoAdNetworkAdapterProtocol | توقّفت جميع محوّلات التوسّط في الإعلانات التي تضم مكافآت والمُدرَجة في صفحة اختيار الشبكات عن استخدام هذه البروتوكولات منذ أكثر من عام. استخدِم GADMediationAdapter للتوسّط والأحداث المخصّصة. |
| GADMRewardBasedVideoAdNetworkConnectorProtocol |
المواقع التي تمت إزالتها
تتم إزالة السمات التالية بدون استبدالها.
| الإصدار 10.0.0 من Class | الموقع |
|---|---|
| GADMediationAdRequest | userBirthday |
| userGender | |
| userHasLocation | |
| userLatitude | |
| userLongitude | |
| userLocationAccuracyInMeters | |
| userLocationDescription | |
| GADCustomEventRequest | userHasLocation |
| userLatitude | |
| userLongitude | |
| userLocationAccuracyInMeters | |
| userLocationDescription |
نقل البيانات من الإصدار 8 إلى الإصدار 9
توقُّف عرض الإعلانات على الإصدار 10 من نظام التشغيل iOS
الحد الأدنى لإصدار iOS الذي يتوافق معه الإصدار 9.0.0 من Google Mobile Ads SDK هو iOS 11.
لن تؤدي الترقية إلى الإصدار 9.0.0 من "Google Mobile Ads SDK" إلى تعطيل تطبيقك على الأجهزة التي تعمل بالإصدار 10 من نظام التشغيل iOS، ولكن لن يتم عرض أي إعلانات على هذه الأجهزة.
تطبيق أكثر صرامة لعناصر التحكّم في شريط الحالة
بدءًا من الإصدار 9.0.0، عند عرض إعلانات بملء الشاشة، يجب أن يضمن تطبيقك أنّ الإعلانات قادرة على التحكّم في عرض شريط الحالة. وستظهر لك رسالة خطأ في السجلّات إذا لم تفعل ذلك.
قد لا تحتاج إلى إجراء أي تغييرات لضمان ذلك، حسب التنسيق المحدّد لوحدات التحكّم في العرض في تطبيقك. يُرجى تحديد ما إذا كنت بحاجة إلى ضبط السمة
childViewControllerForStatusBarHidden
في rootViewController لإعلانك.
إعادة تسمية adDidPresentFullScreenContent: إلى adWillPresentFullScreenContent:
ولن يطرأ أي تغيير على السلوك. يتم استدعاء طريقة التفويض قبل عرض الإعلان مباشرةً، لذا يعكس اسم الطريقة الجديدة وظيفتها بشكل أفضل.
إزالة واجهة برمجة التطبيقات الخاصة بإعدادات الموقع الجغرافي في GADRequest
تم حذف "- (void)setLocationWithLatitude:longitude:accuracy:" من "GADRequest" لأنّ Google لا تستخدم بيانات الموقع الجغرافي لاستهداف الإعلانات. استخدِم واجهات برمجة التطبيقات التابعة لجهات خارجية لتقديم المعلومات إلى شبكات الإعلانات التابعة لجهات خارجية إذا لزم الأمر.
إيقاف واجهات الأحداث المخصّصة نهائيًا
تتيح الأحداث المخصّصة للناشرين الذين يستخدمون ميزة "التوسّط" في "إدارة إعلانات Google" إضافة ميزة "توسّط العرض الإعلاني بدون انقطاع" لشبكة إعلانات ليست من شبكات الإعلانات المتوافقة.
تم إيقاف جميع بروتوكولات الأحداث المخصّصة نهائيًا. بدلاً من ذلك، يمكنك استخدام بروتوكولَي
GADMediationAdapter
وGADMediationAdEventDelegate
الحاليين لتحقيق الوظائف نفسها. يؤدي هذا التغيير إلى تحسين الوضوح
ويتيح لك إنشاء أحداث مخصّصة لـ "الإعلانات مقابل مكافأة" و"الإعلانات البينية التي تظهر أثناء التمرير"، والتي
لم تكن متاحة في السابق.
واجهات برمجة التطبيقات
يعرض الجدول أدناه واجهات برمجة التطبيقات الخاصة بمحوّلات التوسّط المقابلة لواجهات برمجة التطبيقات الخاصة بالأحداث المخصّصة التي يجب استخدامها بدءًا من الإصدار 9.0.0.
| v8 | v9 | |
|---|---|---|
| GADCustomEventBanner GADCustomEventInterstitial GADCustomEventNativeAd |
GADMediationAdapter | GADMediationBannerAd GADMediationInterstitialAd GADMediationInterscrollerAd GADMediationRewardedAd GADMediationNativeAd |
delegate
|
يتم عرض المفوَّض من خلال معالج إكمال التحميل لكل دالة تحميل
من فئة GADMediationAdapter
|
|
-init |
-init |
|
-requestBannerAd:parameter: |
-loadBannerForAdConfiguration: |
|
-requestInterstitialAdWith |
-loadInterstitialFor |
|
-requestNativeAdWithParameter:
|
-loadNativeAdFor |
|
| لا ينطبق | -loadInterscrollerAdFor |
|
| لا ينطبق | -loadRewardedAdFor |
|
-presentFromRootViewController:
|
-presentFromViewController: |
|
-handlesUserClicks |
-handlesUserClicks |
|
-handlesUserImpressions |
-handlesUserImpressions |
|
طُرق التفويض
يسرد الجدول أدناه طرق تفويض أحداث الإعلانات في التوسّط المقابلة لطرق تفويض الأحداث المخصّصة التي يجب استخدامها بدءًا من الإصدار 9.0.0.
| v8 | v9 | |
|---|---|---|
| GADCustomEventBannerDelegate GADCustomEventInterstitialDelegate GADCustomEventNativeAdDelegate |
GADMediationAdEventDelegate | GADMediationAd |
-customEventBanner:didReceiveAd:-customEventInterstitialDidReceiveAd:
|
يتم تضمين حالة تحميل الإعلان في معالج إكمال التحميل لكل دالة تحميل في فئة GADMediationAdapter
|
|
-customEventBanner:didFailAd:-customEventInterstitial:didFailAd:
|
||
-customEventBannerWasClicked:-customEventInterstitialWasClicked:
|
-reportClick |
|
-customEventBannerWill-customEventInterstitialWill
|
-willPresentFullScreenView |
|
-customEventBannerWill-customEventInterstitialWill
|
-willDismissFullScreenView |
|
-customEventBannerDid-customEventInterstitialDid
|
-didDismissFullScreenView |
|
-customEventBannerWill-customEventInterstitialWill
|
-willBackgroundApplication |
|
viewControllerFor |
-[GADMediationBannerAd view] |
|
الطرق والثوابت الأخرى التي تمت إزالتها أو استبدالها
| التغييرات في الطريقة أو الثابت أو السمة | |
|---|---|
kGAD- ثوابت مسبوقة ببادئة
|
تمّت إزالة الموضوع. استخدام ثوابت مسبوقة بـ GAD-
|
GADAdNetworkResponseInfo
|
تمّت إزالة credentials. يمكنك استخدام adUnitMapping كبديل.
|
GAMRequest
|
تم إيقاف السمة kGAMSimulatorID في GAMRequest نهائيًا.
يمكنك استخدام GADSimulatorID في GADRequestConfiguration
بدلاً من ذلك.
|
GADCustomNativeAd
|
تم إيقاف السمة mediaView في GADCustomNativeAd نهائيًا.
يمكنك استخدام mediaContent كبديل.
|
واجهات برمجة التطبيقات لعمليات الشراء داخل التطبيق في GoogleMobileAds |
تمت إزالة واجهات برمجة تطبيقات inAppPurchase في GoogleMobileAds.
|
نقل البيانات من الإصدار 7 إلى الإصدار 8
يقدّم الإصدار 8.0.0 من Google Mobile Ads SDK بعض التغييرات الرئيسية بالإضافة إلى بعض عمليات إعادة التسمية والإزالة لواجهات برمجة التطبيقات.
تعديلات على واجهة برمجة التطبيقات الخاصة بتنسيق ملء الشاشة
بدءًا من الإصدار 8.0.0، تشترك "الإعلانات البينية" و"الإعلانات مقابل مكافأة" في نمط إعلان عام بملء الشاشة لزيادة الاتساق. تختلف واجهات برمجة التطبيقات الجديدة هذه للإعلانات بملء الشاشة عن الإصدار 7 من واجهات برمجة التطبيقات للإعلانات بملء الشاشة في جانبَين رئيسيَّين:
طريقة الفئة الثابتة
load.في ما يلي الطريقة السابقة لتحميل/عرض إعلان بملء الشاشة:
- أنشئ مثيلاً لعنصر الإعلان واحتفظ بمرجع له.
- عيِّن مفوَّضًا يتعامل مع عمليات الاستدعاء الخاصة بالتحميل والعرض.
- حمِّل إعلانًا.
- تحقَّق مما إذا تم تحميل الإعلان باستخدام
isReady. - عرض الإعلان
في الإصدار 8، يتغيّر النهج قليلاً. لم تعد عمليات استدعاء التحميل جزءًا من المفوَّض. بدلاً من ذلك، يتم تمريرها إلى طريقة
loadكمعالج إكمال:- استدعِ طريقة تحميل ثابتة في فئة الإعلان وقدِّم معالجًا لإكمال التحميل.
- في دالة الاستدعاء المتعلّقة باكتمال التحميل، احتفِظ بمرجع للإعلان الذي تم تحميله والذي يتم عرضه.
- يجب تعيين مفوَّض يعالج عمليات معاودة الاتصال للعرض.
- عرض الإعلان
يوفّر النهج الجديد المزايا التالية:
- لن يكون لديك مرجع لإعلان لم يتم تحميله.
- ليس عليك الاحتفاظ بعنصر إعلان أثناء تحميله.
أحداث إعلانية متّسقة:
نوع الحدث واجهة برمجة تطبيقات حالية الإصدار 8 من واجهة برمجة التطبيقات أحداث التحميل GADInterstitialDelegateأوGADRewardedAdDelegate GAMInterstitialAdLoadCompletionHandlerأوGADRewardedAdLoadCompletionHandlerأحداث العروض التقديمية GADFullScreenContentDelegateفي السابق، للاستماع إلى أي أحداث إعلانية، كان عليك تسجيل فئة تنفّذ بروتوكول
GADInterstitialDelegateلخاصية المفوَّض في "الإعلان البيني"، أو تسجيل فئة تنفّذ بروتوكولGADRewardedAdDelegateلخاصية المفوَّض في "الإعلان مقابل مكافأة" حسب الشكل الذي تستخدمه. وكان هذا المفوَّض نفسه يتضمّن طرقًا مرتبطة بكلّ من دورة حياة تحميل الإعلان وعرضه.في الإصدار 8، يتم فصل أحداث التحميل والعرض. يمكنك الآن تسجيل
GADFullScreenContentDelegateفي أي وقت قبل عرض الإعلان بدلاً من أن يُطلب منك ضبط مفوَّض واحد قبل تحميل الإعلان. تنتقل أحداث تحميل الإعلانات، والتي تكون خاصة بكل شكل، إلى معالج واحد لإكمال التحميل يتم تمريره في طريقة التحميل.
إعلان بيني
تحميل الإعلان
توضّح لك مقتطفات الرمز أدناه كيفية تحميل "إعلان بيني" والاستماع إلى الأحداث عند نجاح تحميل الإعلان أو تعذّره.
الإصدار 7
Swift
import GoogleMobileAds import UIKit class ViewController: UIViewController, GADInterstitialDelegate { var interstitial: DFPInterstitial! override func viewDidLoad() { super.viewDidLoad() interstitial = DFPInterstitial(adUnitID: "/21775744923/example/interstitial") interstitial.delegate = self let request = GAMRequest() interstitial.load(request) } /// Tells the delegate an ad request succeeded. func interstitialDidReceiveAd(_ ad: DFPInterstitial) { print("Interstitial ad loaded.") } /// Tells the delegate an ad request failed. func interstitial(_ ad: DFPInterstitial, didFailToReceiveAdWithError error: GADRequestError) { print("Interstitial ad failed to load with error: \(error.localizedDescription)") } }
Objective-C
@import GoogleMobileAds; @import UIKit; @interface ViewController ()@property(nonatomic, strong) DFPInterstitial *interstitial; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.interstitial = [[DFPInterstitial alloc] initWithAdUnitID:@"/21775744923/example/interstitial"]; self.interstitial.delegate = self; GAMRequest *request = [GAMRequest request]; [self.interstitial loadRequest:request]; } /// Tells the delegate an ad request succeeded. - (void)interstitialDidReceiveAd:(DFPInterstitial *)ad { NSLog(@"Insterstitial ad loaded."); } /// Tells the delegate an ad request failed. - (void)interstitial:(DFPInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error { NSLog(@"Interstitial ad failed to load with error: %@", [error localizedDescription]); }
v8
Swift
import GoogleMobileAds import UIKit class ViewController: UIViewController, GADFullScreenContentDelegate { var interstitial: GAMInterstitialAd? override func viewDidLoad() { super.viewDidLoad() let request = GAMRequest() GAMInterstitialAd.load(withAdUnitID:"ca-app-pub-8123415297019784/4985798738", request: request, completionHandler: { (ad, error) in if let error = error { print("Failed to load interstitial ad with error: \(error.localizedDescription)") return } self.interstitial = ad self.interstitial.fullScreenContentDelegate = self } ) } }
Objective-C
@import GoogleMobileAds; @import UIKit; @interface ViewController ()@property(nonatomic, strong) GAMInterstitialAd *interstitial; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; GAMRequest *request = [GAMRequest request]; [GAMInterstitialAd loadWithAdUnitID:@"/21775744923/example/interstitial" request:request completionHandler:^(GAMInterstitialAd *ad, NSError *error) { if (error) { NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]); return; } self.interstitial = ad; self.interstitial.fullScreenContentDelegate = self; }]; }
إعلان صوري
الإصدار 7
Swift
func showInterstitial() { ... if interstitial.isReady { interstitial.present(fromRootViewController: self) } else { print("Ad wasn't ready") } }
Objective-C
- (void)showInterstitial: { ... if (self.interstitial.isReady) { [self.interstitial presentFromRootViewController:self]; } else { NSLog(@"Ad wasn't ready"); } }
v8
Swift
func showInterstitial() { ... if let ad = interstitial { ad.present(fromRootViewController: self) } else { print("Ad wasn't ready") } }
Objective-C
- (void)showInterstitial: { ... if (self.interstitial) { [self.interstitial presentFromRootViewController:self]; } else { NSLog(@"Ad wasn't ready"); } }
أحداث الإعلانات في العروض التقديمية
توضّح لك مقتطفات الرمز أدناه كيفية التعامل مع عمليات الاستدعاء عند عرض الإعلان (بنجاح أو بدون نجاح) وعند إغلاقه.
الإصدار 7
Swift
override func viewDidLoad() { super.viewDidLoad() interstitial = DFPInterstitial(adUnitID: "/21775744923/example/interstitial") interstitial.delegate = self ... } /// Tells the delegate that an interstitial will be presented. func interstitialWillPresentScreen(_ ad: DFPInterstitial) { print("Interstitial ad will be presented.") } /// Tells the delegate the interstitial is to be animated off the screen. func interstitialWillDismissScreen(_ ad: DFPInterstitial) { print("Interstitial ad will be dismissed.") } /// Tells the delegate the interstitial had been animated off the screen. func interstitialDidDismissScreen(_ ad: DFPInterstitial) { print("Interstitial ad dismissed.") } /// Tells the delegate that a user click will open another app /// (such as the App Store), backgrounding the current app. /// /// This is not a reliable callback for an ad click event and is removed in /// version 8. If you wish to listen to an ad causing a user to leave the app, /// use applicationWillResignActive: or sceneWillResignActive: instead. func interstitialWillLeaveApplication(_ ad: DFPInterstitial) { print("Interstitial ad will leave application.") }
Objective-C
- (void)viewDidLoad { [super viewDidLoad]; self.interstitial = [[DFPInterstitial alloc] initWithAdUnitID:"/21775744923/example/interstitial"]; self.interstitial.delegate = self; ... } /// Tells the delegate that an interstitial will be presented. - (void)interstitialWillPresentScreen:(DFPInterstitial *)ad { NSLog(@"Interstitial ad will be presented."); } /// Tells the delegate the interstitial is to be animated off the screen. - (void)interstitialWillDismissScreen:(DFPInterstitial *)ad { NSLog(@"Interstitial ad will be dismissed."); } /// Tells the delegate the interstitial had been animated off the screen. - (void)interstitialDidDismissScreen:(DFPInterstitial *)ad { NSLog(@"Interstitial ad dismissed."); } /// Tells the delegate that a user click will open another app /// (such as the App Store), backgrounding the current app. /// /// This is not a reliable callback for an ad click event and is removed in /// version 8. If you wish to listen to an ad causing a user to leave the app, /// use applicationWillResignActive: or sceneWillResignActive: instead. - (void)interstitialWillLeaveApplication:(DFPInterstitial *)ad { NSLog(@"Interstitial ad will leave application."); }
v8
Swift
override func viewDidLoad() { super.viewDidLoad() let request = GAMRequest() GAMInterstitialAd.load(withAdUnitID:"ca-app-pub-8123415297019784/4985798738", request: request, completionHandler: { (ad, error) in if let error = error { print(error.localizedDescription) return } self.interstitial = ad self.interstitial.fullScreenContentDelegate = self } ) } func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Ad did present full screen content.") } func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) { print("Ad failed to present full screen content with error \(error.localizedDescription).") } func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Ad did dismiss full screen content.") }
Objective-C
- (void)viewDidLoad { [super viewDidLoad]; GAMRequest *request = [GAMRequest request]; [GAMInterstitialAd loadWithAdUnitID:@"/21775744923/example/interstitial" request:request completionHandler:^(GAMInterstitialAd *ad, NSError *error) { if (error) { NSLog(@"interstitial:didFailToReceiveAdWithError: %@", [error localizedDescription]) return; } self.interstitial = ad; self.interstitial.fullScreenContentDelegate = self; }]; } - (void)adDidPresentFullScreenContent:(id)ad { NSLog(@"Ad did present full screen content."); } - (void)ad:(id )ad didFailToPresentFullScreenContentWithError:(NSError *)error { NSLog(@"Ad failed to present full screen content with error %@.", [error localizedDescription]); } - (void)adDidDismissFullScreenContent:(id )ad { NSLog(@"Ad did dismiss full screen content."); }
تمت المكافأة
تحميل الإعلان
الإصدار 7
Swift
import GoogleMobileAds import UIKit class ViewController: UIViewController, GADRewardedAdDelegate { /// The rewarded ad. var rewardedAd: GADRewardedAd? override func viewDidLoad() { super.viewDidLoad() rewardedAd = GADRewardedAd(adUnitID: "ca-app-pub-3940256099942544/1712485313") rewardedAd.delegate = self rewardedAd?.load(GAMRequest()) { error in if let error = error { print("Rewarded ad failed to load with error: \(error.localizedDescription)") } else { print("Rewarded ad loaded.") } } } }
Objective-C
@import GoogleMobileAds; @import UIKit; @interface ViewController ()@property(nonatomic, strong) GADRewardedAd *rewardedAd; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.rewardedAd = [[GADRewardedAd alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/1712485313"]; self.rewardedAd.delegate = self; GAMRequest *request = [GAMRequest request]; [self.rewardedAd loadRequest:request completionHandler:^(GADRequestError * _Nullable error) { if (error) { NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]); } else { NSLog(@"Rewarded ad loaded."); } }]; }
v8
Swift
import GoogleMobileAds import UIKit class ViewController: UIViewController, GADFullScreenContentDelegate { /// The rewarded ad. var rewardedAd: GADRewardedAd? override func viewDidLoad() { super.viewDidLoad() let request = GAMRequest() GADRewardedAd.load(withAdUnitID: "ca-app-pub-8123415297019784/9501821136", request: request, completionHandler: { (ad, error) in if let error = error { print("Rewarded ad failed to load with error: \(error.localizedDescription)") return } self.rewardedAd = ad self.rewardedAd?.fullScreenContentDelegate = self } ) } }
Objective-C
@import GoogleMobileAds; @import UIKit; @interface ViewController ()@property(nonatomic, strong) GADRewardedAd *rewardedAd; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; GAMRequest *request = [GAMRequest request]; [GADRewardedAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/1712485313" request:request completionHandler:^(GADRewardedAd *ad, NSError *error) { if (error) { NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]); return; } self.rewardedAd = ad; NSLog(@"Rewarded ad loaded."); self.rewardedAd.fullScreenContentDelegate = self; }
عرض الإعلان ومعالجة المكافأة
تتطلّب "الإعلانات مقابل مكافأة" منك معالجة الحدث عندما يحصل المستخدم على مكافأة. باستخدام الإصدار 7 من واجهة برمجة تطبيقات GADRewardedAd، يمكنك تنفيذ rewardedAd:userDidEarnReward: كجزء من بروتوكول GADRewardedAdDelegate.
بالنسبة إلى الإصدار 8، يمكنك تنفيذ GADUserDidEarnRewardHandler لعرض الإعلان.
الإصدار 7
Swift
func showRewardedAd() { ... if rewardedAd.isReady { rewardedAd.present(fromRootViewController: self delegate:self) } else { print("Ad wasn't ready") } } /// Tells the delegate that the user earned a reward. func rewardedAd(_ rewardedAd: GADRewardedAd, userDidEarnReward: GADAdReward) { // TODO: Reward the user. }
Objective-C
- (void)showRewardedAd: { ... if (self.rewardedAd.isReady) { [self.rewardedAd presentFromRootViewController:self delegate:self]; } else { NSLog(@"Ad wasn't ready"); } } /// Tells the delegate that the user earned a reward. - (void)rewardedAd:(GADRewardedAd *)rewardedAd userDidEarnReward:(GADAdReward *)reward { // TODO: Reward the user. }
v8
Swift
func showRewardedAd() { ... if let ad = rewardedAd { ad.present(fromRootViewController: self, userDidEarnRewardHandler: { let reward = ad.adReward // TODO: Reward the user. } ) } else { print("Ad wasn't ready") } }
Objective-C
- (void)showRewardedAd: { ... if (self.rewardedAd) { [self.rewardedAd presentFromRootViewController:self userDidEarnRewardHandler:^ { GADAdReward *reward = self.rewardedAd.adReward; // TODO: Reward the user. }]; } else { NSLog(@"Ad wasn't ready"); } }
أحداث الإعلانات في العروض التقديمية
باستخدام واجهة برمجة التطبيقات GADRewardedAd، يمكنك تمرير GADRewardedAdDelegate إلى الإجراء الذي يعرض الإعلان. باستخدام واجهة برمجة التطبيقات GADRewardedAd، يمكنك ضبط
GADFullscreenContentDelegate كسمة في الإعلان قبل عرضه.
الإصدار 7
Swift
func showRewardedAd() { ... if rewardedAd.isReady { rewardedAd.present(fromRootViewController: self delegate:self) } else { print("Ad wasn't ready") } } /// Tells the delegate that the rewarded ad was presented. func rewardedAdDidPresent(_ rewardedAd: GADRewardedAd) { print("Rewarded ad presented.") } /// Tells the delegate that the rewarded ad was dismissed. func rewardedAdDidDismiss(_ rewardedAd: GADRewardedAd) { print("Rewarded ad dismissed.") } /// Tells the delegate that the rewarded ad failed to present. func rewardedAd(_ rewardedAd: GADRewardedAd, didFailToPresentWithError error: Error) { print("Rewarded ad failed to present with error: \(error.localizedDescription).") }
Objective-C
- (void)showRewardedAd: { ... if (self.rewardedAd.isReady) { [self.rewardedAd presentFromRootViewController:self delegate:self]; } else { NSLog(@"Ad wasn't ready"); } } /// Tells the delegate that the rewarded ad was presented. - (void)rewardedAdDidPresent:(GADRewardedAd *)rewardedAd { NSLog(@"Rewarded ad presented."); } /// Tells the delegate that the rewarded ad failed to present. - (void)rewardedAd:(GADRewardedAd *)rewardedAd didFailToPresentWithError:(NSError *)error { NSLog(@"Rewarded ad failed to present with error: %@", [error localizedDescription]); } /// Tells the delegate that the rewarded ad was dismissed. - (void)rewardedAdDidDismiss:(GADRewardedAd *)rewardedAd { NSLog(@"Rewarded ad dismissed."); }
v8
Swift
override func viewDidLoad() { super.viewDidLoad() let request = GAMRequest() GADRewardedAd.load(withAdUnitID: "ca-app-pub-8123415297019784/9501821136", request: request, completionHandler: { (ad, error) in if let error = error { print(error.localizedDescription) return } self.rewardedAd = ad self.rewardedAd?.fullScreenContentDelegate = self } ) } /// Tells the delegate that the rewarded ad was presented. func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Rewarded ad presented.") } /// Tells the delegate that the rewarded ad was dismissed. func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Rewarded ad dismissed.") } /// Tells the delegate that the rewarded ad failed to present. func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) { print("Rewarded ad failed to present with error: \(error.localizedDescription).") }
Objective-C
- (void)viewDidLoad { [super viewDidLoad]; GAMRequest *request = [GAMRequest request]; [GADRewardedAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/1712485313" request:request completionHandler:^(GADRewardedAd *ad, NSError *error) { if (error) { NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]); return; } self.rewardedAd = ad; NSLog(@"Rewarded ad loaded."); self.rewardedAd.fullScreenContentDelegate = self; } /// Tells the delegate that the rewarded ad was presented. - (void)adDidPresentFullScreenContent:(id)ad { NSLog(@"Rewarded ad presented."); } /// Tells the delegate that the rewarded ad failed to present. - (void)ad:(id )ad didFailToPresentFullScreenContentWithError:(NSError *)error { NSLog(@"Rewarded ad failed to present with error: %@", [error localizedDescription]); } /// Tells the delegate that the rewarded ad was dismissed. - (void)adDidDismissFullScreenContent:(id )ad { NSLog(@"Rewarded ad dismissed."); }
إزالة واجهة برمجة التطبيقات GADRewardedBasedVideoAd القديمة
تم طرح واجهة برمجة التطبيقات الأحدث
GADRewardedAd
لأول مرة في مارس 2019، وكانت واجهة برمجة التطبيقات المفضّلة للإعلانات التي تضم مكافآت
لأكثر من 18 شهرًا. وقد تم إجراء المزيد من التحسينات مقارنةً بواجهة برمجة التطبيقات القديمة
GADRewardedBasedVideoAd، بما في ذلك إمكانية تحميل أكثر من
إعلان واحد مقابل مكافأة في كل مرة.
تمت إزالة واجهة برمجة التطبيقات القديمة GADRewardedBasedVideoAd في الإصدار 8.0.0 من حزمة SDK.
إيقاف إعلانات البانر الذكية نهائيًا واستبدالها بإعلانات البانر التكيُّفية
تم إيقاف إعلانات البانر الذكية نهائيًا واستبدالها بإعلانات البانر التكيُّفية. توفّر "إعلانات البانر التكيُّفية" أداءً فائقًا ومرونة أكبر في تحديد عرض الإعلان. إذا كنت تفضّل مواصلة استخدام إعلانات البانر التي تشغل العرض الكامل، يمكنك إجراء ذلك باستخدام إعلان بانر تكيُّفي، كما هو موضّح في مقتطف الرمز التالي:
Swift
class ViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) // Note: The safe area is not known until viewWillAppear. let adSize = getFullWidthAdaptiveAdSize() } func getFullWidthAdaptiveAdSize() -> GADAdSize { // Here safe area is taken into account, hence the view frame is used after the // view has been laid out. let frame = { () -> CGRect in if #available(iOS 11.0, *) { return view.frame.inset(by: view.safeAreaInsets) } else { return view.frame } }() return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(frame.size.width) } }
Objective-C
@implementation ViewController - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // Note: The safe area is not known until viewWillAppear. GADAdSize adSize = [self getFullWidthAdaptiveAdSize]; } - (GADAdSize)getFullWidthAdaptiveAdSize { CGRect frame = self.view.frame; // Here safe area is taken into account, hence the view frame is used after // the view has been laid out. if (@available(iOS 11.0, *)) { frame = UIEdgeInsetsInsetRect(self.view.frame, self.view.safeAreaInsets); } return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(frame.size.width); } @end
إزالة استدعاء الوظيفة عند مغادرة التطبيق
تمت إزالة دالة الاستدعاء willLeaveApplication لجميع أشكال الإعلانات واستبدالها بالطريقتين applicationDidEnterBackground: وsceneDidEnterBackground:. باستخدام واجهات برمجة التطبيقات على مستوى نظام التشغيل، يتم إعلامك عندما يغادر المستخدمون تطبيقك، بغض النظر عمّا إذا كان ذلك بسبب تفاعل مع الإعلان أم لا.
يُرجى العِلم أنّ دالة الاستدعاء willLeaveApplication لم تكن مخصّصة أبدًا لتكون معالجًا للنقرات على الإعلانات، ولم يؤدِّ الاعتماد على دالة الاستدعاء هذه للإبلاغ عن النقرات إلى الحصول على مقياس دقيق. على سبيل المثال، أدّت النقرة على رمز "خيارات الإعلان" التي شغّلت متصفّحًا خارجيًا إلى استدعاء دالة الاستدعاء ولكن لم يتم احتساب نقرة.
إعادة تسمية الصفوف
يسرد الجدول أدناه أسماء فئات معيّنة تم تغييرها أو إزالتها في الإصدار 8. باختصار:
- تمت إعادة تسمية جميع الصفوف المرتبطة بـ "
GADUnifiedNativeAd" إلى "GADNativeAd". - تمت إزالة "
GADRewardBasedVideoAd" و"GADNativeExpressAdView" و"GADInstreamAd". - تم استبدال جميع الفئات التي تبدأ بالبادئة
DFPبالبادئةGAM.
| الإصدار 7.68.0 من Class | الإصدار 8.0.0 من Class |
|---|---|
| DFPBannerView | GAMBannerView |
| DFPBannerViewOptions | GAMBannerViewOptions |
| DFPInterstitial | GAMInterstitialAd |
| DFPRequest | GAMRequest |
| GADRequestError | NSError |
| GADUnifiedNativeAdView | GADNativeAdView |
| GADUnifiedNativeAd | GADNativeAd |
| GADUnifiedNativeAdAssetIdentifiers | GADNativeAdAssetIdentifiers |
| GADUnifiedNativeAdDelegate | GADNativeAdDelegate |
| GADUnifiedNativeAdUnconfirmedClickDelegate | GADNativeAdUnconfirmedClickDelegate |
| GADNativeCustomTemplateAd | GADCustomNativeAd |
| GADNativeCustomTemplateAdLoaderDelegate | GADCustomNativeAdLoaderDelegate |
| GADNativeAdDelegate | GADCustomNativeAdDelegate |
| GADInAppPurchase | تمّت إزالته |
| GADInterstitial | GADInterstitialAd |
| GADNativeExpressAdView | تمّت إزالته |
| GADRewardBasedVideoAd | تمّت إزالته |
| GADInstreamAd | تمّت إزالته |
| GADInstreamAdView | تمّت إزالته |
الطرق التي تمت إزالتها أو استبدالها
يسرد الجدول أدناه التغييرات المحدّدة في الإصدار 8. باختصار:
- تمت إزالة الطرق والخصائص التي تم إيقافها نهائيًا في السابق.
- تمت إزالة طرق التفويض في
-willLeaveApplication:لجميع التنسيقات. - تم نقل اسم فئة شبكة الإعلانات إلى السمة
GADResponseInfo. - تم نقل معرّف الجهاز الاختباري إلى السمة
GADRequestConfiguration.
| الإصدار 7.68.0 من Class | الإصدار 7.68.0 من واجهة برمجة التطبيقات | الإصدار 8.0.0 من واجهة برمجة التطبيقات | ملاحظات |
|---|---|---|---|
| GADMobileAds | +configureWithApplicationID: | -startWithCompletionHandler: | تم الآن ضبط رقم تعريف التطبيق في Info.plist. |
| +disableAutomatedInApp |
-disableAutomatedInApp |
||
| +disableSDKCrashReporting | -disableSDKCrashReporting | ||
| GADRequest | testDevices | GADRequestConfiguration |
تنطبق السمة testDeviceIdentifiers على جميع طلبات عرض الإعلانات، بينما تم ضبط السمة testDevices القديمة لكل طلب. |
| الجنس | تمّت إزالته | ||
| عيد الميلاد | تمّت إزالته | ||
| +sdkVersion | GADMobileAds.sharedInstance |
||
| -setBirthday |
تمّت إزالته | ||
| -setLocationWithDescription: | -setLocationWith |
||
| -tagForChildDirectedTreatment: | [GADMobileAds.sharedInstance.requestConfiguration tagForChildDirectedTreatment] | ||
| GADErrorCode | kGADError* | GADError* | يتم إسقاط البادئة k من جميع ثوابت رموز الخطأ.
|
| GADBannerView | hasAutoRefreshed | autoloadEnabled | |
| inAppPurchaseDelegate | تمّت إزالته | ||
| mediatedAdView | تمّت إزالته | ||
| adNetworkClassName | responseInfo |
||
| DFPBannerView | -setValidAdSizesWithSizes: | -setValidAdSizes: | |
| DFPBannerViewOptions | -adSizeDelegate | تمّت إزالته | |
| GADBannerViewDelegate | -adViewDidReceiveAd: | -bannerViewDidReceiveAd: | |
| -adView:didFailToReceive |
-bannerView:didFailToReceive |
||
| -adViewWillPresentScreen: | -bannerViewWillPresentScreen: | ||
| -adViewWillDismissScreen: | -bannerViewWillDismissScreen: | ||
| -adViewDidDismissScreen: | -bannerViewDidDismissScreen: | ||
| -adViewWillLeaveApplication: | تمّت إزالته | ||
| GADNativeCustomTemplateAd | templateID | GADCustomNativeAd.formatID | |
| -performClickOnAssetWithKey: |
-performClickOnAssetWithKey: | ||
| GADNativeAdImageAd |
preferredImageOrientation | GADNativeAdMediaAdOptions |
|
| GADInterstitial | inAppPurchaseDelegate | تمّت إزالته | |
| isReady | تمّت إزالته | استخدِم canPresentFrom |
|
| hasBeenUsed | تمّت إزالته | ||
| -init | -initWithAdUnitID: | ||
| -setAdUnitID: | -initWithAdUnitID: | ||
| adNetworkClassName | responseInfo |
||
| -interstitialWill |
تمّت إزالته | ||
| GADUnifiedNativeAd | videoController | mediaContent.videoController | |
| adNetworkClassName | responseInfo |