ATTrackingManager.requestTrackingAuthorization doesn't prompt on macOS

I'm attempting to use App Tracking Transparency but the requestTrackingAutorization function doesn't cause the prompt to appear. I've gone through the documentation and lots of other iOS oriented posts to no avail.

I've added a check for authorization status to applicationDidBecomeActive and if the status isn't authorized or denied then I prompt. The completion handler is called immediately with a status of notDetermined without a prompt appearing.

I've added the AppTrackingTransparency framework to my project and the key NSUserTrackingUsageDescription to Info.plist. My app supports macOS 11+ and the code has been tested on macOS 12.6.

This is holding up the macOS App Store review process, so any help is greatly appreciated.

Here's the code and the results:

   func applicationDidBecomeActive(_ notification: Notification) {
    print("applicationDidBecomeActive, is application active? \(NSApp.isActive)")

     print("tracking authorization is \(ATTrackingManager.trackingAuthorizationStatus.rawValue)")
    if trackingAutorizationStatus != .authorized,
      trackingAutorizationStatus != .denied {
      print("tracking authorization is not determined")
      ATTrackingManager.requestTrackingAuthorization { status in
        print("request tracking authorization returned: \(status.rawValue)")
      }
    }
  }

  /*  results
   applicationDidBecomeActive, is application active? true
   tracking authorization is 0
   tracking authorization is not determined
   request tracking authorization returned: 0
  */

Answered by stjohn in 736312022

For anyone else with this issue, here's the feedback number for the bug I submitted: FB11793091

Please file a bug report about this issue using the Feedback Assistant.

Accepted Answer

For anyone else with this issue, here's the feedback number for the bug I submitted: FB11793091

ATTrackingManager.requestTrackingAuthorization doesn't prompt on macOS
 
 
Q