ios – How to optimize Firebase Analytics start up?


I have Firebase Analytics and Remote Config pods installed.

When changing the phone’s region (or restarting my phone) and starting my app again, the remote config fetchAndActivate takes more time to complete. (5 to 10 sec! instead of < 2sec)

After some investigation, I found that if I remove the firebase analytics pod, I don’t see that issue anymore!

What I understand is the Analytics will be started by Firebase Core when calling FirebaseApp.configure

Question:

  • Is there a way to post pone Analytics startup and fetching or has it running in the background so it will not affect the rest of my app?
  • Does using Google Analytics instead of Firebase Analytics could solve the issue or we are talking about the same thing (there is a different pod for Google Analytics)?

Here the code that takes more time to complete.

private func setupRemoteConfig(completionHandler: @escaping (_ error: Error?) -> Void) {

    let remoteConfigSettings = RemoteConfigSettings()
    var fetchInterval: TimeInterval = 0

    remoteConfigSettings.minimumFetchInterval = fetchInterval
    remoteConfig.configSettings = remoteConfigSettings
    
    remoteConfig.fetchAndActivate { status, error in

        guard error == nil, status == .successFetchedFromRemote else {
            completionHandler(error)
            return
        }


        completionHandler(nil)
    }
}

Thanks

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img