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
*/