Request App Tracking Transparency authorization
To display the App Tracking Transparency authorization request for accessing the IDFA:
Update your Info.plist to add the
NSUserTrackingUsageDescription
key with a custom message describing your usagecall
ATTrackingManager.requestTrackingAuthorization
when the APP is active and the view is ready.ATTrackingManager.requestTrackingAuthorization { status in print("Tracking: authorized:", status == .authorized) }
here are good candidates to place the request in:
AppDelegate::applicationDidBecomeActive
SceneDelegate::sceneDidBecomeActive
ViewController::viewDidAppear
Please check out the complete example:
AdPlayerSample (SceneDelegate.swift)
Useful links:
App Tracking Transparency
Prepare for iOS 14