בדף הזה מוסבר איך לבצע העברות לגרסה הנוכחית ולגרסאות הקודמות של Google Mobile Ads SDK ל-iOS. הגרסה 12.0.0 צפויה לצאת בפברואר 2025.
מעבר מגרסת SDK v11 ל-v12
שדרוג ל-Xcode 16.0
הגרסה המינימלית הנתמכת של Xcode עלתה ל-16.0.
תמיכה במתן שמות ב-Swift
גרסה 12.0.0 כוללת שינויים בהתאם למוסכמות השמות שמפורטות בהנחיות לתכנון ממשקי API של Swift. השינויים האלה משפיעים רק על Swift. לא בוצעו שינויים בשמות של ממשקי ה-API ל-Objective-C.
שינויים בקידומת הכיתה
בוצעו השינויים הבאים בתחיליות הכיתות:
- הסרת הקידומת
GAD
מהשמות של כל הסוגים. - שינית את השם של הקידומת
GAM
ל-AdManager
. - שינית את השם של הקידומת
GADM
ל-Mediation
.
פתרון שגיאות
הדרך הטובה ביותר לפתור שגיאות שנובעות מהשינויים האלה היא לבצע תיקון באמצעות Fix-It.
פתרון התנגשויות בשמות
כדי לפתור התנגשויות בשמות, צריך להשתמש במרחב השמות שסופק על ידי המודול. לדוגמה, GADRequest
נקרא עכשיו Request
. במרחבי השמות הבאים מופיעה הכיתה Request
של Google Mobile Ads SDK:
import GoogleMobileAds
...
var request: GoogleMobileAds.Request?
רשימה מפורטת של השינויים ב-Swift
בטבלאות הבאות מפורטים השינויים שבוצעו בממשקי ה-API של Swift:
גרסה 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 |
Ad Manager | |
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:) |
שינויים ב-API לשליטה במצב ההשתקה של הסרטון
המאפיין isMuted
והשיטה setMute:
ב-GADVideoController
מוחלפים במאפיין muted
.
שינויים במודעות מותאמות מוטמעות
כדי למקסם את ניצול המרחב, מודעות רספונסיביות בתוך הטקסט לא תופסות מקום בפריים בהתחלה. קריאה ל-CGSizeFromGADAdSize(_:)
עם גודל מודעה מותאם בתוך הטקסט מחזירה עכשיו גובה של 0
עד ש-Google Mobile Ads SDK מחזירה מודעה.
מודעות לרשת החיפוש בהתאמה אישית שהוסרו
הכיתות הבאות יוסרו ללא החלפה:
GADDynamicHeightSearchBannerView
GADDynamicHeightSearchRequest
GADSearchBannerView
שינויים בקודי שגיאה
קודי השגיאה הבאים השתנו:
מחלקה | הערות |
---|---|
GADErrorMediationNoFill |
השגיאות מוחזרות עכשיו כ-GADErrorNoFill . |
GADErrorReceivedInvalidResponse |
הוחלף ב-GADErrorReceivedInvalidAdString . |
הוסר GADSimulatorID
בוצעה הסרה של GADSimulatorID
. הסימולטורים כבר מוגדרים במצב בדיקה כברירת מחדל.
שינויים בטירגוט בהתאמה אישית
במילון customTargeting
ב-GADRequest
נעשה עכשיו שימוש ב-Any
במקום ב-String
בתור סוג הערך. כך אפשר להעביר ערכים מספריים ל-API.
שינויים בפרמטרים של תכונות נוספות
- אין יותר תמיכה בהעברת המפתח
max_ad_content_rating
אלadditionalParameters
. במאמר סינון תוכן של מודעות מוסבר איך מגדירים סיווג מקסימלי לתוכן מודעה.
מעבר מגרסה 10 לגרסה 11
יעד מינימלי לפריסה
יעד הפריסה המינימלי הועלה ל-iOS 12.
גרסת Xcode מינימלית
גרסת Xcode המינימלית הנתמכת עלתה ל-15.1.
הצגת המודעות תופסק ב-iOS 12
Google Mobile Ads SDK בגרסה 11.0.0 מציג מודעות רק במכשירים עם מערכת ההפעלה iOS 13 ומעלה.
הסרת התלות ב-GoogleAppMeasurement
בגרסה 11.0.0, התלות ב-GoogleAppMeasurement
הוסרה. התלות הזו, שהפעילה את המתג של מדדי המשתמשים ב-AdMob, תופסק בתחילת שנת 2024. כדי להמשיך לאסוף מדדי משתמשים ב-AdMob, עליכם לקשר את האפליקציה ב-AdMob ל-Firebase ולשלב את ה-SDK של Google Analytics for Firebase באפליקציה.
שינויים בתצוגת המודעות במסך מלא
השינויים הבאים משפיעים על הפורמטים השונים של המודעות:
- מודעה בפתיחת אפליקציה
- מעברון
- ההטבה הופעלה
- מודעות מעברון מתגמלות
הפרמטר של ה-View Controller ב--canPresentFromRootViewController:error:
וב--presentFromRootViewController:
יכול להיות null. אם מעבירים את הערך nil, המודעה תוצג על ידי מנהל התצוגה (view controller) העליון בהיררכיית מנהלי התצוגה.
שיטות שהוסרו
השיטות הבאות הוסרו.
סוג v11.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 . |
נכסים שהוסרו
המאפיינים הבאים יוסרו.
Class v11.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, GADAdLoader
לא שולח בקשה להצגת מודעה אם הערך של delegate
לא תואם לפרוטוקול של סוג המודעות המבוקש. בעבר, הבדיקה נכשלה אחרי שליחת הבקשה להצגת מודעה.
שינויים בהתנהגות הבדיקה
בטבלה הבאה מפורטים התנאים המעודכנים שבהם המאפיינים הבאים מחזירים את הערך true
.
מחלקה | נכס |
---|---|
GADMediationAdConfiguration | isTestRequest |
GADCustomEventRequest | isTesting |
v10.0.0 | v11.0.0 |
|
|
מעבר מגרסה 9 לגרסה 10
הצגת המודעות תופסק ב-iOS 11
מודעות מוצגות באמצעות Google Mobile Ads SDK בגרסה 10.0.0 רק במכשירים עם מערכת ההפעלה iOS מגרסה 12 ואילך.
השדרוג ל-Google Mobile Ads SDK בגרסה 10.0.0 לא יגרום לכשלים באפליקציה במכשירי iOS 11 ו-iOS 10, אבל לא יוצגו מודעות במכשירים האלה.
אין יותר תמיכה ביצירת גרסאות build באמצעות קוד בייט
מעכשיו צריך להשבית את הקוד הבינארי באפליקציות לנייד כדי לשלב את Google Mobile Ads SDK.
הסוגים שהוסרו
סוג | הערות |
---|---|
GADGender | אין החלפה. |
GADMRewardBasedVideoAdNetworkAdapterProtocol | כל מתאמי בחירת הרשתות עם תגמול שרשומים ב- Choose Networks הפסיקו להשתמש בפרוטוקולים האלה לפני יותר משנה. משתמשים ב- GADMediationAdapter לצורך בחירת רשת (Mediation) ואירועים מותאמים אישית. |
GADMRewardBasedVideoAdNetworkConnectorProtocol |
נכסים שהוסרו
המאפיינים הבאים יוסרו ללא החלפה.
Class v10.0.0 | נכס |
---|---|
GADMediationAdRequest | userBirthday |
userGender | |
userHasLocation | |
userLatitude | |
userLongitude | |
userLocationAccuracyInMeters | |
userLocationDescription | |
GADCustomEventRequest | userHasLocation |
userLatitude | |
userLongitude | |
userLocationAccuracyInMeters | |
userLocationDescription |
מעבר מ-v8 ל-v9
הצגת המודעות מופסקת ב-iOS 10
הגרסה המינימלית של iOS שתומכת בגרסה 9.0.0 של Google Mobile Ads SDK היא iOS 11.
השדרוג ל-Google Mobile Ads SDK בגרסה 9.0.0 לא יגרום לכשלים באפליקציה במכשירי iOS 10, אבל לא יוצגו מודעות במכשירים האלה.
אכיפה מחמירה יותר של אמצעי הבקרה בשורת הסטטוס
החל מגרסה 9.0.0, כשמציגים מודעות בפורמט מסך מלא, האפליקציה צריכה לוודא שהמודעות יכולות לשלוט בהצגה של שורת הסטטוס. אם לא תעשו זאת, תופיע הודעת שגיאה ביומני.
בהתאם לפריסה הספציפית של בקרי התצוגה באפליקציה, יכול להיות שלא תצטרכו לבצע שינויים כדי לוודא זאת. כדאי לבדוק אם צריך להגדיר את הנכס childViewControllerForStatusBarHidden
ב-rootViewController
של המודעה.
שינוי השם של adDidPresentFullScreenContent: ל-adWillPresentFullScreenContent:
אין שינוי בהתנהגות. שיטת הענקת הגישה מופעלת ממש לפני שהמודעה עומדת להופיע, ולכן שם השיטה החדש משקף טוב יותר את הפונקציונליות שלה.
הסרת API להגדרת מיקום ב-GADRequest
- (void)setLocationWithLatitude:longitude:accuracy:
נמחק מ-GADRequest
כי Google לא משתמשת בנתוני מיקום לצורך טירגוט מודעות. אם צריך, משתמשים בממשקי API של צד שלישי כדי לספק את המידע לרשתות מודעות של צד שלישי.
הוצאה משימוש של ממשקי אירועים מותאמים אישית
אירועים בהתאמה אישית מאפשרים לבעלי אפליקציות שמשתמשים בתהליך בחירת הרשת (Mediation) של AdMob להוסיף תהליך בחירת רשת (Mediation) ב-Waterfall לרשת מודעות שאינה אחת מרשתות המודעות הנתמכות.
כל פרוטוקולי האירועים בהתאמה אישית הוצאו משימוש. במקום זאת, מומלץ להשתמש בפרוטוקולים הקיימים GADMediationAdapter
ו-GADMediationAdEventDelegate
כדי להשיג את אותן פונקציות. השינוי הזה מאפשר לכם ליצור אירועים מותאמים אישית למודעות מתגמלות ולמודעות 'מעברון', שלא היו זמינים בעבר.
ממשקי API
בטבלה שבהמשך מפורטים ממשקי ה-API התואמים של מתאמי בחירת הרשת ל-API של אירועים מותאמים אישית, שבהם צריך להשתמש החל מגרסה 9.0.0.
v8 | v9 | |
---|---|---|
GADCustomEventBanner GADCustomEventInterstitial GADCustomEventNativeAd |
GADMediationAdapter | GADMediationBannerAd GADMediationInterstitialAd GADMediationInterscrollerAd GADMediationRewardedAd GADMediationNativeAd |
delegate
|
ה-delegate מוחזר על ידי הטיפול בהשלמת הטעינה של כל פונקציית טעינה מסוג GADMediationAdapter
|
|
-init |
-init |
|
-requestBannerAd:parameter: |
-loadBannerForAdConfiguration: |
|
-requestInterstitialAdWith |
-loadInterstitialFor |
|
-requestNativeAdWithParameter:
|
-loadNativeAdFor |
|
לא רלוונטי | -loadInterscrollerAdFor |
|
לא רלוונטי | -loadRewardedAdFor |
|
-presentFromRootViewController:
|
-presentFromViewController: |
|
-handlesUserClicks |
-handlesUserClicks |
|
-handlesUserImpressions |
-handlesUserImpressions |
שיטות הענקת גישה
בטבלה הבאה מפורטות שיטות הענקת הגישה (delegate) המתאימות לאירועי מודעות בתהליך בחירת הרשת, שצריך להשתמש בהן החל מגרסה 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 .
|
GADCustomNativeAd
|
האפשרות mediaView ב-GADCustomNativeAd הוצאה משימוש.
במקום זאת, אתם צריכים להשתמש ב-mediaContent .
|
ממשקי API לרכישות מתוך האפליקציה ב-GoogleMobileAds |
ממשקי ה-API של inAppPurchase ב-GoogleMobileAds הוסרו.
|
מעבר מגרסה 7 לגרסה 8
גרסה 8.0.0 של Google Mobile Ads SDK כוללת כמה שינויים משמעותיים, וגם שינויי שמות והסרות של ממשקי API.
עדכונים לגבי פורמט במסך מלא
החל מגרסה 8.0.0, מודעות המעברון והמודעות המתגמלות כוללות חוויה כללית של של המודעה במסך לקבלת יותר עקביות. ממשקי ה-API החדשים להצגת מודעות במסך מלא כוללים ההבדלים העיקריים בין ממשקי ה-API של מודעות במסך מלא בגרסה 7:
שיטת הכיתה הסטטית
load
.הגישה הקודמת לטעינה/הצגה של מודעה במסך מלא היא:
- יצירת מופע של אובייקט מודעה והפניה אליו.
- הקצאת משתמש אחר המטפל בטעינה והצגה של התקשרות חזרה.
- טוענים מודעה.
- אפשר להשתמש ב-
isReady
כדי לבדוק אם המודעה נטענה. - מציגים את המודעה.
בגרסה 8 הגישה משתנה מעט. אין יותר קריאות חוזרות (callback) חלק מהענקת גישה. במקום זאת, הן מועברות ל-method
load
בתור רכיב handler של השלמה:- מפעילים שיטת טעינה סטטית על סיווג המודעה ומספקים השלמת טעינה המטפל.
- בקריאה החוזרת על השלמת הטעינה, שומרים הפניה למודעה שנטענה הוחזרו.
- צריך להקצות משתמש אחר שיטפל בקריאות חוזרות (callback).
- מציגים את המודעה.
הגישה החדשה מספקת את היתרונות הבאים:
- אף פעם לא יהיה לך הפניה למודעה שלא נטענה.
- אין צורך להחזיק אובייקט של מודעה בזמן שהיא נטענת.
אירועי מודעות עקביים.
סוג אירוע API קיים v8 API טעינת אירועים GADInterstitialDelegate
אוGADRewardedAdDelegate
GADInterstitialAdLoadCompletionHandler
אוGADRewardedAdLoadCompletionHandler
אירועי מצגת GADFullScreenContentDelegate
בעבר, כדי להאזין לאירועי מודעות, הייתם רושמים כיתה מטמיעים את
GADInterstitialDelegate
לנכס הענקת גישה של מעברון, או לרשום מחלקה מטמיעים אתGADRewardedAdDelegate
לנכס בעל הגישה של מודעה מתגמלת, בהתאם לפורמט שבהם משתמשים. לאותו נציג היו שיטות שקשורות גם לטעינה וגם הצגת מחזור החיים של מודעה.בגרסה 8, אירועי הטעינה וההצגה הם נפרדים. מעכשיו אפשר לרשום
GADFullScreenContentDelegate
בכל שלב לפני הצגת המודעה במקום להידרש להגדיר כלל בעל גישה לפני טעינת המודעה. אירועים של טעינת מודעות, שהם ספציפיים לכל אירוע , מעבר ל-handler יחיד של השלמת טעינה שהועברה בשיטת הטעינה.
מעברון
טעינת מודעה
קטעי הקוד הבאים מראים איך לטעון מודעת מעברון ולהאזין אירועים שבהם המודעה מצליחה או לא נטענת.
v7
Swift
import GoogleMobileAds import UIKit class ViewController: UIViewController, GADInterstitialDelegate { var interstitial: GADInterstitial! override func viewDidLoad() { super.viewDidLoad() interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910") interstitial.delegate = self let request = GADRequest() interstitial.load(request) } /// Tells the delegate an ad request succeeded. func interstitialDidReceiveAd(_ ad: GADInterstitial) { print("Interstitial ad loaded.") } /// Tells the delegate an ad request failed. func interstitial(_ ad: GADInterstitial, didFailToReceiveAdWithError error: GADRequestError) { print("Interstitial ad failed to load with error: \(error.localizedDescription)") } }
Objective-C
@import GoogleMobileAds; @import UIKit; @interface ViewController ()@property(nonatomic, strong) GADInterstitial *interstitial; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.interstitial = [[GADInterstitial alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910"]; self.interstitial.delegate = self; GADRequest *request = [GADRequest request]; [self.interstitial loadRequest:request]; } /// Tells the delegate an ad request succeeded. - (void)interstitialDidReceiveAd:(GADInterstitial *)ad { NSLog(@"Insterstitial ad loaded."); } /// Tells the delegate an ad request failed. - (void)interstitial:(GADInterstitial *)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: GADInterstitialAd? override func viewDidLoad() { super.viewDidLoad() let request = GADRequest() GADInterstitialAd.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) GADInterstitialAd *interstitial; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; GADRequest *request = [GADRequest request]; [GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910" request:request completionHandler:^(GADInterstitialAd *ad, NSError *error) { if (error) { NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]); return; } self.interstitial = ad; self.interstitial.fullScreenContentDelegate = self; }]; }
מודעה ברשת המדיה
v7
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"); } }
אירועים של מודעות מצגת
קטעי הקוד הבאים מראים איך לטפל בקריאות חוזרות (callback) כשהמודעה מוצגת (בהצלחה או נכשלת) וכשהיא נסגרת.
v7
Swift
override func viewDidLoad() { super.viewDidLoad() interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910") interstitial.delegate = self ... } /// Tells the delegate that an interstitial will be presented. func interstitialWillPresentScreen(_ ad: GADInterstitial) { print("Interstitial ad will be presented.") } /// Tells the delegate the interstitial is to be animated off the screen. func interstitialWillDismissScreen(_ ad: GADInterstitial) { print("Interstitial ad will be dismissed.") } /// Tells the delegate the interstitial had been animated off the screen. func interstitialDidDismissScreen(_ ad: GADInterstitial) { 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: GADInterstitial) { print("Interstitial ad will leave application.") }
Objective-C
- (void)viewDidLoad { [super viewDidLoad]; self.interstitial = [[GADInterstitial alloc] initWithAdUnitID:"ca-app-pub-3940256099942544/4411468910"]; self.interstitial.delegate = self; ... } /// Tells the delegate that an interstitial will be presented. - (void)interstitialWillPresentScreen:(GADInterstitial *)ad { NSLog(@"Interstitial ad will be presented."); } /// Tells the delegate the interstitial is to be animated off the screen. - (void)interstitialWillDismissScreen:(GADInterstitial *)ad { NSLog(@"Interstitial ad will be dismissed."); } /// Tells the delegate the interstitial had been animated off the screen. - (void)interstitialDidDismissScreen:(GADInterstitial *)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:(GADInterstitial *)ad { NSLog(@"Interstitial ad will leave application."); }
v8
Swift
override func viewDidLoad() { super.viewDidLoad() let request = GADRequest() GADInterstitialAd.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]; GADRequest *request = [GADRequest request]; [GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910" request:request completionHandler:^(GADInterstitialAd *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."); }
ההטבה הופעלה
טעינת מודעה
v7
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(GADRequest()) { 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; GADRequest *request = [GADRequest 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 = GADRequest() 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]; GADRequest *request = [GADRequest 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 של ה-API של GADRewardedAd
, מטמיעים
rewardedAd:userDidEarnReward:
כחלק מהפרוטוקול GADRewardedAdDelegate
.
בגרסה 8, אתם צריכים להטמיע את GADUserDidEarnRewardHandler
כדי
מציגים את המודעה.
v7
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"); } }
אירועים של מודעות מצגת
באמצעות ה-API של GADRewardedAd
מעבירים GADRewardedAdDelegate
ל-method
שמציג את המודעה. באמצעות ה-API של GADRewardedAd
מגדירים
GADFullscreenContentDelegate
כנכס במודעה לפני הצגת
המודעה.
v7
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 = GADRequest() 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]; GADRequest *request = [GADRequest 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 API מהגרסה הקודמת
הגרסה החדשה יותר
GADRewardedAd
ממשק API הושק לראשונה במרץ 2019, והוא הפך למתגמל המועדף
API למשך יותר מ-18 חודשים. יש בה יותר שיפורים בהשוואה לדור הקודם
API של GADRewardedBasedVideoAd
, כולל היכולת לטעון יותר מממשק אחד
מודעה מתגמלת אחת בכל פעם.
ה-API הקודם של GADRewardedBasedVideoAd
הוסר בגרסת ה-SDK בגרסה 8.0.0.
הוצאה משימוש של מודעות באנר חכמות לטובת מודעות באנר מותאמות
מודעות באנר חכם הוצאו משימוש לטובת מודעת באנר מותאמת מודעות. מודעות באנר מותאמות מספקות ביצועים מעולים וגמישות רבה יותר הגדרה של רוחב המודעה. אם מעדיפים להמשיך להשתמש במודעות באנר ברוחב מלא, ניתן עדיין להשתמש במודעות באנר מותאמות, כפי שמוצג בקטע הקוד הבא:
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
קריאה החוזרת (callback) של כל הפורמטים של המודעות הגיעה
הוסרה לטובת
applicationDidEnterBackground:
וגם
sceneDidEnterBackground:
שיטות. שימוש בממשקי API ברמת מערכת ההפעלה מודיע לך בכל פעם שמשתמשים יוצאים מהאפליקציה, ללא קשר ל
בין אם כתוצאה מאינטראקציה עם מודעה ובין אם לא.
לתשומת ליבך willLeaveApplication
הקריאה החוזרת אף פעם לא הייתה אמורה להיות
מטפל בקליקים על מודעה, והסתמכות על קריאה חוזרת זו לדיווח על קליקים לא
כדי ליצור מדד מדויק. לדוגמה, קליק על 'מודעות שנבחרו'
שהפעיל דפדפן חיצוני הפעיל את הקריאה החוזרת (callback), אך לא ספר
לקליק.
שינויי שמות של כיתה
בטבלה הבאה מפורטים שמות של כיתות ספציפיים שהשתנו או הוסרו 8. לסיכום:
- השם של כל הכיתות שקשורות אל
GADUnifiedNativeAd
השתנה ל-GADNativeAd
. - נוספו ל-
GADRewardBasedVideoAd
, ל-GADNativeExpressAdView
ול-GADInstreamAd
הוסר. - כל הכיתות עם הקידומת
DFP
הוחלפו בקידומתGAM
.
גרסה 7.68.0 | גרסה v8.0.0 |
---|---|
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 | ממשק API של גרסה 7.68.0 | ממשק API של גרסה 8.0.0 | הערות |
---|---|---|---|
GADMobileAds | +configureWithApplicationID: | -startWithCompletionHandler: | מזהה האפליקציה מוגדר עכשיו ב-Info.plist. |
+disableAutomatedInApp |
-disableAutomatedInApp |
||
+disableSDKCrashReporting | -disableSDKCrashReporting | ||
GADRequest | testDevices | GADRequestConfiguration |
המאפיין testDeviceIdentifiers חל על כל הבקשות להצגת מודעות, ואילו המאפיין המאפיין הישן מסוג testdevice הוגדר לפי בקשה. |
gender | הוסר | ||
יום הולדת | הוסר | ||
+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 |