From b094a2450b4c2d09e166c2b6d8b060442bbcb694 Mon Sep 17 00:00:00 2001 From: Justin Malandruccolo Date: Fri, 5 Jan 2024 20:25:43 -0800 Subject: [PATCH] Update samples to be stable for version 11.0.0 release PiperOrigin-RevId: 596143741 --- .../APIDemo/APIDemo/AdMobAdTargetingTableViewController.m | 4 ++-- .../APIDemo/AdMobNativeCustomMuteThisAdViewController.m | 2 +- .../APIDemo/APIDemo/GAMCustomVideoControlsController.m | 2 +- .../AdManagerAppOpenExample/AppOpenAdManager.swift | 3 +-- .../AppOpenExample/AppOpenExample/AppOpenAdManager.swift | 3 +-- .../APIDemo/AdManagerMultipleAdSizesViewController.swift | 2 +- .../APIDemo/APIDemo/AdMobAdTargetingTableViewController.swift | 4 ++-- .../APIDemo/APIDemo/AdMobBannerSizesViewController.swift | 3 ++- 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Objective-C/advanced/APIDemo/APIDemo/AdMobAdTargetingTableViewController.m b/Objective-C/advanced/APIDemo/APIDemo/AdMobAdTargetingTableViewController.m index 6fdcf82b..13c4b38b 100644 --- a/Objective-C/advanced/APIDemo/APIDemo/AdMobAdTargetingTableViewController.m +++ b/Objective-C/advanced/APIDemo/APIDemo/AdMobAdTargetingTableViewController.m @@ -147,8 +147,8 @@ - (IBAction)loadTargetedAd:(id)sender { GADRequest *request = [GADRequest request]; if ([self.childDirectedLabel.text isEqual:@"Yes"] || [self.childDirectedLabel.text isEqual:@"No"]) { - [GADMobileAds.sharedInstance.requestConfiguration - tagForChildDirectedTreatment:self.childDirectedLabel.text.boolValue]; + GADMobileAds.sharedInstance.requestConfiguration.tagForChildDirectedTreatment = + [NSNumber numberWithBool:self.childDirectedLabel.text.boolValue]; } [self.bannerView loadRequest:request]; diff --git a/Objective-C/advanced/APIDemo/APIDemo/AdMobNativeCustomMuteThisAdViewController.m b/Objective-C/advanced/APIDemo/APIDemo/AdMobNativeCustomMuteThisAdViewController.m index 039dac20..7176e05a 100644 --- a/Objective-C/advanced/APIDemo/APIDemo/AdMobNativeCustomMuteThisAdViewController.m +++ b/Objective-C/advanced/APIDemo/APIDemo/AdMobNativeCustomMuteThisAdViewController.m @@ -44,7 +44,7 @@ @implementation AdMobNativeCustomMuteThisAdViewController - (void)viewDidLoad { [super viewDidLoad]; - self.versionLabel.text = GADMobileAds.sharedInstance.sdkVersion; + self.versionLabel.text = GADGetStringFromVersionNumber(GADMobileAds.sharedInstance.versionNumber); NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"NativeAdView" owner:nil diff --git a/Objective-C/advanced/APIDemo/APIDemo/GAMCustomVideoControlsController.m b/Objective-C/advanced/APIDemo/APIDemo/GAMCustomVideoControlsController.m index acd15554..aafcbb2a 100644 --- a/Objective-C/advanced/APIDemo/APIDemo/GAMCustomVideoControlsController.m +++ b/Objective-C/advanced/APIDemo/APIDemo/GAMCustomVideoControlsController.m @@ -37,7 +37,7 @@ @implementation GAMCustomVideoControlsController - (void)viewDidLoad { [super viewDidLoad]; - self.versionLabel.text = GADMobileAds.sharedInstance.sdkVersion; + self.versionLabel.text = GADGetStringFromVersionNumber(GADMobileAds.sharedInstance.versionNumber); [self refreshAd:nil]; } diff --git a/Swift/admanager/AdManagerAppOpenExample/AdManagerAppOpenExample/AppOpenAdManager.swift b/Swift/admanager/AdManagerAppOpenExample/AdManagerAppOpenExample/AppOpenAdManager.swift index a1c2d05c..29a086bd 100644 --- a/Swift/admanager/AdManagerAppOpenExample/AdManagerAppOpenExample/AppOpenAdManager.swift +++ b/Swift/admanager/AdManagerAppOpenExample/AdManagerAppOpenExample/AppOpenAdManager.swift @@ -68,8 +68,7 @@ class AppOpenAdManager: NSObject { print("Start loading app open ad.") GADAppOpenAd.load( withAdUnitID: "/6499/example/app-open", - request: GADRequest(), - orientation: UIInterfaceOrientation.portrait + request: GADRequest() ) { ad, error in self.isLoadingAd = false if let error = error { diff --git a/Swift/admob/AppOpenExample/AppOpenExample/AppOpenAdManager.swift b/Swift/admob/AppOpenExample/AppOpenExample/AppOpenAdManager.swift index 0b487957..79626dba 100644 --- a/Swift/admob/AppOpenExample/AppOpenExample/AppOpenAdManager.swift +++ b/Swift/admob/AppOpenExample/AppOpenExample/AppOpenAdManager.swift @@ -68,8 +68,7 @@ class AppOpenAdManager: NSObject { print("Start loading app open ad.") GADAppOpenAd.load( withAdUnitID: "ca-app-pub-3940256099942544/5575463023", - request: GADRequest(), - orientation: UIInterfaceOrientation.portrait + request: GADRequest() ) { ad, error in self.isLoadingAd = false if let error = error { diff --git a/Swift/advanced/APIDemo/APIDemo/AdManagerMultipleAdSizesViewController.swift b/Swift/advanced/APIDemo/APIDemo/AdManagerMultipleAdSizesViewController.swift index 3feed24b..5170a636 100644 --- a/Swift/advanced/APIDemo/APIDemo/AdManagerMultipleAdSizesViewController.swift +++ b/Swift/advanced/APIDemo/APIDemo/AdManagerMultipleAdSizesViewController.swift @@ -47,7 +47,7 @@ class AdManagerMultipleAdSizesViewController: UIViewController, GADAdSizeDelegat view.addConstraint( NSLayoutConstraint( item: bannerView!, attribute: .bottom, relatedBy: .equal, - toItem: bottomLayoutGuide, attribute: .top, multiplier: 1, constant: 0)) + toItem: view.safeAreaLayoutGuide.bottomAnchor, attribute: .top, multiplier: 1, constant: 0)) view.addConstraint( NSLayoutConstraint( item: bannerView!, attribute: .centerX, relatedBy: .equal, diff --git a/Swift/advanced/APIDemo/APIDemo/AdMobAdTargetingTableViewController.swift b/Swift/advanced/APIDemo/APIDemo/AdMobAdTargetingTableViewController.swift index 4c75857e..b14f8e78 100644 --- a/Swift/advanced/APIDemo/APIDemo/AdMobAdTargetingTableViewController.swift +++ b/Swift/advanced/APIDemo/APIDemo/AdMobAdTargetingTableViewController.swift @@ -151,9 +151,9 @@ class AdMobAdTargetingTableViewController: UITableViewController, UIPickerViewDa @IBAction func loadTargetedAd(_ sender: AnyObject) { let request = GADRequest() if childDirectedLabel.text == "Yes" { - GADMobileAds.sharedInstance().requestConfiguration.tag(forChildDirectedTreatment: true) + GADMobileAds.sharedInstance().requestConfiguration.tagForChildDirectedTreatment = true } else if childDirectedLabel.text == "No" { - GADMobileAds.sharedInstance().requestConfiguration.tag(forChildDirectedTreatment: false) + GADMobileAds.sharedInstance().requestConfiguration.tagForChildDirectedTreatment = false } bannerView.load(request) } diff --git a/Swift/advanced/APIDemo/APIDemo/AdMobBannerSizesViewController.swift b/Swift/advanced/APIDemo/APIDemo/AdMobBannerSizesViewController.swift index 5b51f723..e3371c5a 100644 --- a/Swift/advanced/APIDemo/APIDemo/AdMobBannerSizesViewController.swift +++ b/Swift/advanced/APIDemo/APIDemo/AdMobBannerSizesViewController.swift @@ -98,7 +98,8 @@ class AdMobBannerSizesViewController: UIViewController, UIPickerViewDataSource, view.addConstraint( NSLayoutConstraint( item: bannerView!, attribute: .bottom, relatedBy: .equal, - toItem: bottomLayoutGuide, attribute: .top, multiplier: 1, constant: 0)) + toItem: view.safeAreaLayoutGuide.bottomAnchor, attribute: .top, multiplier: 1, constant: 0 + )) view.addConstraint( NSLayoutConstraint( item: bannerView!, attribute: .centerX, relatedBy: .equal,