This is the 19th day of my participation in the Gwen Challenge in November. Check out the details: The last Gwen Challenge in 2021.

The introduction

Background: ios approval is rejected, and the IDFA permission application view cannot be displayed in ios 15

We’re looking forward to completing our review, but we need more information to continue. Your app uses the AppTrackingTransparency framework, but we are unable to locate the App Tracking Transparency permission request when reviewed on iOS 15.1.

I. Adaptation to IDFA

Background: IdFA is required for personalized functions of aurora push and open screen advertisements

IOS access to open screen advertising tutorial: Tencent Youmob.com as a case (adapted to iOS15)

1.1 Open screen Advertisement Acquisition IDFA is used to push personalized advertisements

Changes required for the iOS14.5 update to request user authorization to access app-related data to track users or devices. For details, please visit developer.apple.com/documentati…

In the Info. Add NSUserTrackingUsageDescription plist, description for IDFA, etc. The purpose of the advertising identifier

	<key>NSUserTrackingUsageDescription</key>
	<string>This ID will be used to push personalized ads to you</string>

Copy the code

Popover small words copywriting suggestions:

  1. Access to mark permission to provide you with better quality, safe personalized services and content, we will not be used for other purposes without consent; After this function is enabled, you can turn it off at any time in Settings – Privacy.

  2. Access to IDFA and other advertising identifiers to provide you with better quality, secure personalized services and content; After this function is enabled, you can turn it off at any time in Settings – Privacy.

Authorized popup window display needs to call requestTrackingAuthorizationWithCompletionHandler: method.

It is suggested to process the advertising logic after the callback of the traffic master waiting method is completed. In this way, if users are authorized to use advertising identifiers such as IDFA, The iOS SDK can use IDFA and other advertising identifiers for advertising requests. The code is as follows:

#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>. - (void)requestIDFA {
  [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
    // Authorize the callback to complete
     [self loadGDTAd];/ / load first
  }];
}

Copy the code

The complete adaptation code is as follows

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    BOOL result = [GDTSDKConfig registerAppId:@ ""];//
    
    
    if (result) {
// [self setupGDTSplashAd];
        [self requestIDFA];
        

        NSLog(@" Registration successful");
    }

    return YES;
}
- (void)setupGDTSplashAd{
    
    // splash the LoadAd logic
    GDTSplashAd *splash = [[GDTSplashAd alloc] initWithPlacementId:@ ""];
    
    splash.delegate = self; // Set the proxy

    
// If ([[UIScreen mainScreen] bounds].size. Height >= 568.0f) {// If ([[UIScreen mainScreen] bounds].size.
// splash.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"LaunchImage-568h"]];
// } else {
// splash.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"LaunchImage"]];
/ /}
    splash.fetchDelay = 5; // Developers can set the opening screen pull time, timeout will abandon display
    self.splash =splash;
    
    // Set different background images for different iPhone devices
    
    UIImage *splashImage = [UIImage imageNamed:@"SplashNormal"];
    if (isIPhoneXSeries()) {
        splashImage = [UIImage imageNamed:@"SplashX"];
    } else if ([UIScreen mainScreen].bounds.size.height == 480) {
        splashImage = [UIImage imageNamed:@"SplashSmall"];
    }
    // * Whether to require the open screen video V+ function

// self.splash.needZoomOut = self.supportZoomoutViewSwitch.isOn;
    self.splash.backgroundImage = splashImage;
    self.splash.backgroundImage.accessibilityIdentifier = @"splash_ad";

    //
    
    [self.splash loadFullScreenAd];


    

}


#pragma mark - GDTSplashAdDelegate

- (void)splashAdDidLoad:(GDTSplashAd *)splashAd {
// if (splashAd.splashZoomOutView) {
// [self.view addSubview:splashAd.splashZoomOutView];
// splashAd.splashZoomOutView.rootViewController = self;
// // Supports drag and drop
// [splashAd.splashZoomOutView supportDrag];
/ /}
    NSLog(@"%s", __func__);
    
    NSString *text = [NSString stringWithFormat:@"%@ Advertising success", splashAd.adNetworkName];
    
    
    NSLog(@"ecpm:%ld ecpmLevel:%@ text:%@", splashAd.eCPM, splashAd.eCPMLevel,text);
    
    // splash show logic
    // Set a custom logo to display a half-screen advertisement
    
    UIWindow *window = [[UIApplication sharedApplication] keyWindow];
    [self.splash showFullScreenAdInWindow:window withLogoImage:[UIImage imageNamed:@"img_login_logo"] skipView:nil];

}

- (void)splashAdSuccessPresentScreen:(GDTSplashAd *)splashAd
{
    NSLog(@"%s",__FUNCTION__);
// self.tipsLabel.text = ;
    NSLog(@" Successful AD display");
    

}



- (void)requestIDFA {
    
    
    if([self isNeedrequestTrackingAuthorization]){
        
        if (@available(iOS 14. *)) { [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {// Authorize the callback to complete
               [self setupGDTSplashAd ];// Load loadGDTAd first
            }];
              

        } else{[self setupGDTSplashAd ];// Load loadGDTAd first}}else{[self setupGDTSplashAd ];// Load loadGDTAd first}} - (BOOL)isNeedrequestTrackingAuthorization{

    
if (@available(iOS 14, *)) {
        ATTrackingManagerAuthorizationStatus status = ATTrackingManager.trackingAuthorizationStatus;
        switch (status) {
            case ATTrackingManagerAuthorizationStatusDenied:
                NSLog(@" User rejected");
                return YES;
                

                break;
            case ATTrackingManagerAuthorizationStatusAuthorized:
                NSLog(@" User permission");
                break;
            case ATTrackingManagerAuthorizationStatusNotDetermined:
                NSLog(@" User for selection or not popup");
                return YES;

                break;
            default:
                break; }}else {
        // Fallback on earlier versions
       if ([ASIdentifierManager.sharedManager isAdvertisingTrackingEnabled]) {
       }else {
          NSLog("User has enabled restricted AD tracking"); }}return NO;
    
    
}



Copy the code

In cases where users refuse to authorize UserTracking, consider tapping into Apple’s SKAdNetwork framework for AD analytics.

Developer.apple.com/documentati…

    <key>SKAdNetworkItems</key>
    <array>
        <dict>
            <key>SKAdNetworkIdentifier</key>
            <string>f7s53z58qe.skadnetwork</string>
        </dict>
        <dict>
             <key>SKAdNetworkIdentifier</key>
             <string>example200.skadnetwork</string>
        </dict>
    </array>

Copy the code

SKAdNetworkIdentifier : f7s53z58qe.skadnetwork

1.2 Aurora Push

To use the AppTrackingTransparency Framework To request user authorization To access IDFA information

———————————————— Copyright notice: This article is the original article of CSDN blogger “# public account: iOS Reverse”, in accordance with CC 4.0 BY-SA copyright agreement, please attach the original source link and this statement.

The original link: blog.csdn.net/z929118967/…

Register the aurora

    [JPUSHService setupWithOption:launchOptions appKey:@ "" channel:@"App Store" apsForProduction:YES advertisingIdentifier:[self testIDFA]];

Copy the code

Get idfaString

#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>

- (NSString*)testIDFA {
    NSString  __block *idfaString = @ "";
    
    
    
    if (@available(iOS 14. *)) { [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {if(status == ATTrackingManagerAuthorizationStatusAuthorized) { idfaString = [[ASIdentifierManager sharedManager] advertisingIdentifier].UUIDString; }}]; }else {
        // Use the original method to access IDFA
        if ([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
             idfaString = [[ASIdentifierManager sharedManager] advertisingIdentifier].UUIDString;
        }


    }
    NSLog(@"idfaString: %@", idfaString);

    return idfaString;
    
}


Copy the code

1.3 Mounting Permission Configuration

Added the function of open screen advertising, app privacy statement of appStoreConnect background, collected data must contain IDFA, idFA needs to be added for advertising, otherwise it will be rejected.

Specific configuration:

App home page privacy collection this time added an identifier -> AD identifier for third-party ads, not associated with the user’s identity, will use the device ID for tracking purposes.

1.4 iOS15 adaptation

If in the iOS15 didFinishLaunchingWithOptions method call + in the AppDelegate (void)requestTrackingAuthorizationWithCompletionHandler:(void(^)(ATTrackingManagerAuthorizationStatus status))completion; , the permission application dialog box cannot be displayed.

Solution with delayed call: recommended in the – (void) applicationDidBecomeActive: (UIApplication *) application {method pop-up idfa permission to apply for the view. If no pop-up is displayed, the call is delayed by 1 second

[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
              // Authorize the callback to complete
               [self setupGDTSplashAd ];// Load loadGDTAd first
            }];

Copy the code

Application for IDFA permission only when the program enters the foreground


- (void)applicationDidBecomeActive:(UIApplication *)application {
    
    if([self isNeedrequestTrackingAuthorization]){
        if (@available(iOS 14. *)) { [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {// Authorize the callback to complete
    // [self setupGDTSplashAd ]; // Load loadGDTAd first}]; }} [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
    [JPUSHService setBadge:0];



    
        
}

Copy the code

see also

More content please pay attention to # applets: iOS Reverse, only to present valuable information for you, focus on mobile technology research field; For more services and advice, please follow # publicid: iOS Reverse.