I am doing a research on getting the IDFA on iOS 14. I am using iPhone 8 Plus.
I have added
<key>NSUserTrackingUsageDescription</key>
<string>App would like to access IDFA for tracking purpose</string>
in the .plist
file.
Then added
let type = ATTrackingManager.trackingAuthorizationStatus;
which returns .denied
, having
func requestPermission() {
ATTrackingManager.requestTrackingAuthorization { status in
switch status {
case .authorized:
// Tracking authorization dialog was shown
// and we are authorized
print("Authorized")
// Now that we are authorized we can get the IDFA
print(ASIdentifierManager.shared().advertisingIdentifier)
case .denied:
// Tracking authorization dialog was
// shown and permission is denied
print("Denied")
case .notDetermined:
// Tracking authorization dialog has not been shown
print("Not Determined")
case .restricted:
print("Restricted")
@unknown default:
print("Unknown")
}
}
}
But I'm getting .denied
without any popup.
Do you know what is happening?
There's an option "Allow Apps to Request to Track" in system's Settings app, and if it's off, requestTrackingAuthorization
will return .denied
immediately.