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?
ATT means that if your app collects data about end-users and shares it with other companies for purposes of tracking across apps and websites, you must use the ATT consent prompt and get user consent in both the publisher and advertiser app. If you don't track, there is no need to display the prompt.
Apps targeted towards iOS14 will need to use AppTrackingTransparency framework along with AdSupport framework to get the IDFA. AppTrackingTransparency allows developer to request permission from the user to read IDFA instead of just getting the IDFA from the ASIdentifierManager.
The main component of ATT is the in-app popup (also known as the ATT prompt) that asks the user if they would like to “allow the app to track your activity across other companies' apps and websites.” Users have an option to opt-out or opt-in, and are opted out by default.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With