So far my app was using Adjust, FB and Firebase SDKs for Analytics purposes. So my AppDelegate
's didFinishLaunchingWithOptions
method was roughly looking like this:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Adjust
let adjustConfig = ADJConfig(appToken: ADJ_TOKEN, environment: ADJ_ENV)
Adjust.appDidLaunch(adjustConfig)
// FB
ApplicationDelegate.shared.application(application,
didFinishLaunchingWithOptions: launchOptions)
if #available(iOS 14, *) {
Settings.setAdvertiserTrackingEnabled(true)
}
// Firebase
FirebaseApp.configure()
// Other initializations...
return true
}
With the addition of the AppTrackingTransparency
framework, I am now displaying a popup to the users at launch:
// Before return true in didFinishLaunchingWithOptions
requestTrackingPermission()
func requestTrackingPermission() {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { status in
switch status {
case .authorized:
break
case .denied:
break
case .notDetermined:
break
case .restricted:
break
@unknown default:
break
}
}
}
}
I am a bit confused, however, about what to do next: do I need to move the Analytics initialization lines in the .authorized
case of the tracking permission request? What should I do for the denied/restricted cases? And in what situation may the case be not determined?
Thank you for your help
Please refer this link to understand more about Firebase and Apple's App Tracking Transparency framework
Supporting iOS 14