skip to Main Content

I noticed that each time I re-install my app OR change iPhone’s region, the fetchAndActivate takes more time (> 5sec and even much more)

The Android version does not seem to be affected by that long delay.

Am I doing something wrong with the code below?

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)
    }
}
```

2

Answers


  1. Chosen as BEST ANSWER

    To people who has similar issue.

    From my side, the reason why it was slow to start was because of the Firebase Analytics.

    By default FirebaseApp.configure starts the analytics if present.

    So, when changing the phone's region, it was probably deleting cache information and was fetching again when starting the app and for some reason, it can take some time. For sure, more than normal startup in my case.


  2. While your code for setupRemoteConfig looks good on its surface, there could be other factors contributing to the long fetch time on iOS compared to Android:

    1. Throttling: Apple implements stricter throttling on network access for apps compared to Android. This means fetching remote config might take longer on iOS, especially after re-installation or region change, as the app needs to establish a new connection.

    2. Network conditions: Network conditions on the user’s device can significantly impact fetch time. Cellular data might be slower than Wi-Fi, and weak signal strength can lead to even further delays.

    3. Remote config server: The location and responsiveness of your remote config server can also play a role. Make sure your server is well-optimized and located close to your target user base.

    4. Minimum fetch interval: While you set the minimum fetch interval to 0, there might be internal caching mechanisms in iOS that delay the actual fetch for some period. Consider adjusting the interval based on your update frequency and user experience requirements.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search