iosiphonexcodeadmobgoogle-mobile-ads

Google AdMob new SDK setup for iOS : SKAdNetworkItems, NSUserTrackingUsageDescription, ATTrackingManager. Guideline 5.1.2 - Legal - Privacy - Data Use


Google AdMob now shows below warning.

enter image description here

Prepare your apps for iOS 14 Apple announced the new AppTrackingTransparency framework, which requires changes to your iOS apps. Implement the GMA SDK 7.64.0 (or later) and set up consent messaging to help prevent a significant loss in ad revenue.

Some apps haven't been configured to use Apple's SKAdNetwork To ensure you're getting credit for all ads activity, like app installs, be sure to configure SKAdNetwork with Google's network IDs.

Some of your iOS apps require a GMA SDK update To keep ads serving normally and minimize a loss in ad revenue, implement the GMA SDK 7.64.0 (or later) for your iOS apps. And configure the SKAdNetwork in your apps with Google's network ID.

For this I did these changes

  1. Updated GoogleMobileAds SDK to 8.0

2.Updated app's Info.plist file with these 3 keys:

        1. GADApplicationIdentifier key with a string value of AdMob app ID.
        2. Added SKAdNetworkItems in plist as mentioned here https://developers.google.com/admob/ios/ios14
        3. NSUserTrackingUsageDescription key with value 'Game_Name would like to access IDFA for thirdparty advertising purpose'  

info.plist screenshot enter image description here

Also added App Tracking Transparancy Alert:

- (void)requestIDFA
{
    if (@available(iOS 14.0, *))
    {
        [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
            
            // Admob Ads
            [self loadAdmob_Ads];
            [self loadRewardedInterstitial];
            [self requestAppOpenAd];
        }];
    }
    else
    {
        // Admob Ads
        [self loadAdmob_Ads];
        [self loadRewardedInterstitial];
        [self requestAppOpenAd];
    }
}

Is there anything else I need to do in Xcode ?

See below image from Appstoreconnect, Am I need to set Yes Or No?(Yes, we use advertising data for tracking purpose?) we are not tracking user, not sure about Google AdMob. enter image description here

Data Used to Track You ( Identifiers), Data Linked to You ( Identifiers ). Is it right settings for Google AdMob ? enter image description here

Recent AppStore Rejection Message:

Guideline 5.1.2 - Legal - Privacy - Data Use and Sharing

We noticed you do not use App Tracking Transparency to request the user's permission before tracking their activity across apps and websites. The app privacy information you provided in App Store Connect indicates you collect data in order to track the user, including Device ID and Advertising Data.

Starting with iOS 14.5, apps on the App Store need to receive the user’s permission through the AppTrackingTransparency framework before collecting data used to track them. This requirement protects the privacy of App Store users.

Updates: Game approved by Apple. Here is game with latest admob ads (GADInterstitialAd, GADAppOpenAd, GADRewardedInterstitialAd, GADRewardedAd): https://apps.apple.com/us/app/ocean-fishing-master-3d-games/id1550945081


Solution

  • Updates: Game approved by Apple. Here is game with latest admob ads (GADInterstitialAd, GADRewardedInterstitialAd, GADRewardedAd, GADAppOpenAd):

    Added Google Admob SKAdNetworkIdentifier values in Info.plist

    <key>SKAdNetworkItems</key>
      <array>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>cstr6suwn9.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>4fzdc2evr5.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>2fnua5tdw4.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>ydx93a7ass.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>5a6flpkh64.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>p78axxw29g.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>v72qych5uu.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>c6k4g5qg8m.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>s39g8k73mm.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>3qy4746246.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>3sh42y64q3.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>f38h382jlk.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>hs6bdukanm.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>prcb7njmu6.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>wzmmz9fp6w.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>yclnxrl5pm.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>4468km3ulz.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>t38b2kh725.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>7ug5zh24hu.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>9rd848q2bz.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>n6fk4nfna4.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>kbd757ywx3.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>9t245vhmpl.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>2u9pt9hc89.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>8s468mfl3y.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>av6w8kgt66.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>klf5c3l5u5.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>ppxm28t8ap.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>424m5254lk.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>uw77j35x4d.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>e5fvkxwrpn.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>zq492l623r.skadnetwork</string>
        </dict>
        <dict>
          <key>SKAdNetworkIdentifier</key>
          <string>3qcr597p9d.skadnetwork</string>
        </dict>
      </array>
    

    Added requestIDFA in didFinishLaunchingWithOptions. It opens App Tracking Transparency dialog box.

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
        
        [[GADMobileAds sharedInstance] startWithCompletionHandler:nil];
        [self requestIDFA];
    .
    .
    .
    }
    

    requestIDFA function:

    - (void)requestIDFA
    {
        if (@available(iOS 14.0, *))
        {
            [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
    
                // Admob Ads
                [self requestAppOpenAd];
                [self loadAdmob_Ads];
                [self loadRewardedInterstitial];
            }];
        }
        else
        {
            // Admob Ads
            [self requestAppOpenAd];
            [self loadAdmob_Ads];
            [self loadRewardedInterstitial];
        }
    }
    

    Added AppTrackingTransparency.framework to Xcode.

    In info.plist added NSUserTrackingUsageDescription

    <key>NSUserTrackingUsageDescription</key>
    <string>This identifier will be used to deliver personalized ads to you.</string>
    

    Admob ads related functions:

    - (void)requestAppOpenAd {
      self.appOpenAd = nil;
      [GADAppOpenAd loadWithAdUnitID:ADMOB_APP_OPEN_ID
                             request:[GADRequest request]
                         orientation:UIInterfaceOrientationPortrait
                   completionHandler:^(GADAppOpenAd *_Nullable appOpenAd, NSError *_Nullable error) {
                     if (error) {
                       NSLog(@"Failed to load app open ad: %@", error);
                       return;
                     }
                     self.appOpenAd = appOpenAd;
                     self.appOpenAd.fullScreenContentDelegate = self;
    
                   }];
    }
    
    - (void)tryToPresentAd
    {
            if (self.appOpenAd) {
              UIViewController *rootController = self.window.rootViewController;
              [self.appOpenAd presentFromRootViewController:rootController];
            } else {
              // If you don't have an ad ready, request one.
              [self requestAppOpenAd];
            }
    }
    
    - (void)applicationDidBecomeActive:(UIApplication *)application {
     [self tryToPresentAd];
    }
    
    -(void)loadAdmob_Ads
    {
        GADRequest *request = [GADRequest request];
                
        [GADInterstitialAd loadWithAdUnitID:ADMOB_FULL_SCREEM
                                        request:request
                              completionHandler:^(GADInterstitialAd *ad, NSError *error)
        {
          if (error)
          {
                    NSLog(@"\nAdmob Failed to load interstitial ad with error: %@", [error localizedDescription]);
              return;
          }
          self.interstitial = ad;
          self.interstitial.fullScreenContentDelegate = self;
        }];
    }
    
    -(void)showAdmobAdsFullScreen
    {
            if (self.interstitial) {
                [self.interstitial presentFromRootViewController:self.viewController];
              }
    }
    
    -(void)loadRewardedInterstitial
    {
        [GADRewardedInterstitialAd
               loadWithAdUnitID:ADMOB_REWARDED_INTERSTITIAL
                        request:[GADRequest request]
              completionHandler:^(
                  GADRewardedInterstitialAd *_Nullable rewardedInterstitialAd,
                  NSError *_Nullable error) {
                if (!error) {
                  self.rewardedInterstitialAd = rewardedInterstitialAd;
                  self.rewardedInterstitialAd.fullScreenContentDelegate = self;
                }
              }];
    }
    
    -(void)playRewardedInterstitial
    {
              [self.rewardedInterstitialAd presentFromRootViewController:self.viewController
                                    userDidEarnRewardHandler:^{
                                        
                                        [self rewardInterstitialDoneRewardUser];
          
                                        [self loadRewardedInterstitial];
                                    }];
    }
    

    Google Official Documentation:

    SKAdNetworkItems iOS 14 Updates : https://developers.google.com/admob/ios/ios14

    GADInterstitialAd : https://developers.google.com/admob/ios/interstitial

    GADRewardedInterstitialAd : https://developers.google.com/admob/ios/rewarded-interstitial

    GADRewardedAd : https://developers.google.com/admob/ios/rewarded-ads

    GADAppOpenAd : https://developers.google.com/admob/ios/app-open-ads

    Adaptive Banner ( GADBannerView ) : https://developers.google.com/admob/ios/banner/adaptive

    NSAppTransportSecurity : https://developers.google.com/admob/ios/app-transport-security