AppTrackingTransparency and SDK initialization (Facebook, Firebase...)

354 Views Asked by At

I'm a bit lost about AppTrackingTransparency and how to initialize some SDKs (like FB or Firebase), especially after a user first install of the app.

I don't want to show the user the app tracking transparency popup IMMEDIATELY after he installs the app because it feels too aggressive. I prefer him to go through a few steps before.

However, I know that I need to initialize some SDKs in the AppDelegate's didFinishLaunching method, i.e.:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Firebase
    FirebaseApp.configure()
    // FB
    ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
    if #available(iOS 14, *) {
        Settings.setAdvertiserTrackingEnabled(true)
    }
    return true
}

What I'm afraid of is that initializing these SDKs before showing the ATTrackingManager.requestTrackingAuthorization popup later in the app could lead to a rejection from Apple, or these SDKs to not work properly. Or can I let this code like this and call the requestTrackingAuthorization later without any issue?

Thank you

1

There are 1 best solutions below

0
On

Firebase should always be the last initialization before the return true. Otherwise your code is good.