App Tracking Transparency in iOS 15 (Swift & SwiftUI)

Federica Benacquista
3 min readFeb 13, 2022

I recently tried to publish an app where I implemented the ATT popup in a common view controller.

No need to say that Apple rejected it because it wouldn’t show up on iOS 15 and above (it worked fine on iOS 14).

So after a while of searching and trying, I found the solution:

The fist 2 steps have to be done both for Swift and SwiftUI.

  1. Import the AppTrackingTransparency framework to your target.

2. In your Info.plist file, you need to add the tracking usage description key which, in code is the following:

<key>NSUserTrackingUsageDescription</key><string>This identifier will be used to deliver personalized ads to you</string>

3. Present the pop-up.

Swift

Before I show you how to do it remember the following information:

  • You must only show the pop-up once. This means the code to show it must be called once.
  • If you can’t see the popup on your device, check your settings to see if tracking is enabled.
  • It can take some time for the pop-up to show after you implement my code (normally it would be a few seconds, be patient).

--

--

Federica Benacquista
Federica Benacquista

Written by Federica Benacquista

I’m a self taught iOS developer and soon to be entrepreneur. I like to explain tricky concepts as easily as possible and it’s exactly what I do here.

No responses yet