App Tracking Transparency Framework in iOS 14

devCracker
2 min readMay 30, 2021

Ever wondered when you are browsing about headset in the browser and in a few minutes you would see an Advertisement offering branded headsets?. The application would collect data across the apps and share this to data brokers/customize the ads. Before iOS14, the user has to go to iPhone/iPad settings(Settings -> Privacy -> Tracking) to turn off this as in this screenshot.

Settings to disable app tracking permissions
application tracking iOS

And the application will not ask the user’s permissions inside the app, But with iOS 14.5, apple introduced a new framework as App Tracking Transparency to value the user’s privacy. So now the user can deny/allow the apps who collects user’s data(e.g., age, gender, browsing history etc.) and share it to data brokers or to personalise ads?.

Implementing ATT(App Tracking Transparency) Framework:

In order to collect the data, your app must comply this policy by using this framework.
First, we have to add a description as we do for a camera, a location usage description in an application’s plist.

add the description in plist, to prompt to user why you want to track the data across the apps
app tracking transparency permission description in plist

Next, we have to add this code to request the user permission.

ATTrackingManager.requestTrackingAuthorization { status inswitch status {case .authorized:case .denied:case .notDetermined:case .restricted:}}

That’s it, now it’s upto the user, whether he/she can allow you or deny you to collect the data.

Thanks for reading and Happy Coding!!!. To get more useful stuff, please follow me or subscribe me.

--

--

devCracker

professional mobile app developer | iOS | Android | GraphQL | Typescript | nodejs. Sports and musics fuels my mind to get back to development