For the complete documentation index, see llms.txt. This page is also available as Markdown.

Prepare for iOS 14+

This guide outlines the changes needed for iOS 14 support.

Starting from iOS 14, it will be giving users the choice to block the IDFA identifier at the app level. Among other changes, what this means is the iOS 14 update will require apps to ask users for permission to collect and share data, which is called the App Tracking Transparency framework. It aims to present the app-tracking authorization request to the end-user. If an app does not present this request, the IDFA will automatically be zeroed out which may lead to a significant loss in ad revenue.

Request AppTrackingTransparency for IDFA

Step 1. Link AppTrackingTransparency.framework in your project

Step 2. Add User Tracking Usage Description in Info.plist

Step 3. Request permission before requesting ads

Link AppTrackingTransparency.framework to your app target.

Add User Tracking Usage Description in Info.plist

Just like the usage of Camera / Album / Location, you need to provide a message telling users that why your app needs permission.

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

Request permission before requesting ads

To present the authorization request, call requestTrackingAuthorizationWithCompletionHandler:. Call it while the app is active; a request made earlier shows no prompt. We recommend waiting for the completion callback prior to loading ads so that if the user grants the App Tracking Transparency permission, the SDK can use the IDFA in ad requests.

import AppTrackingTransparency

func requestIDFA() {
    ATTrackingManager.requestTrackingAuthorization { status in
        // Tracking authorization completed. Start loading ads here.
        DispatchQueue.main.async {
            self.loader.load(nil)
        }
    }
}
@import AppTrackingTransparency;

- (void)requestIDFA {
    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
        // Tracking authorization completed. Start loading ads here.
        dispatch_async(dispatch_get_main_queue(), ^{
            [self.loader loadAdRequest:nil];
        });
    }];
}

For more information about the possible status values, see ATTrackingManager.AuthorizationStatus.

Last updated