App Tracking Transparency Framework in iOS 14
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.
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.
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.