Unable to present Tracking User Description alert on real device

Hi everybody. I have some problems with the function "ATTrackingManager.requestTrackingAuthorization(completionHandler:)", provided by AppTrackingTransparency library.
It shows nothing when tested on real device. However, if I build and run the same exact code on a simulator, it works properly and shows the alert.

Here some additional informations:
  • My deployment iOS target is 14.0

  • I added "Privacy - Tracking Usage Description" key in the Info.plist file

  • I added "AppTrackingTransparency.framework" into my app's Target

  • I imported "AppTrackingTransparency" in my Swift file

  • The toggle in Settings -> Privacy -> Tracking "Allow App to Request to Track" is on

My swift code looks like this:
Code Block
//MySwiftFile.swift
func askPermission() {
ATTrackingManager.requestTrackingAuthorization { (status) in
//handled
print(status)
}
}

On a real device, the AuthorizationStatus always return value 2 (denied).

Does anybody have the same issue?

You need to call it when UIApplicationStateActive.

In my case, the problem was that I was calling ATTrackingManager.requestTrackingAuthorization from AppDelegates didFinishLaunchingWithOptions function.

Just calling the function from applicationDidBecomeActive fix the problem.

Unable to present Tracking User Description alert on real device
 
 
Q