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
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.
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:
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.
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.
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.
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.