Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
App Check
Which platforms are affected?
iOS
Description
We are experiencing significant delays in retrieving Firebase AppCheck tokens on iOS devices. The token retrieval process is taking between 300ms to 500ms, which seems unusually slow compared to the performance on Android devices. This delay occurs consistently, even when retrieving cached tokens.
Reproducing the issue
Implement Firebase AppCheck in an iOS application.
Measure the time taken to retrieve an AppCheck token.
Repeat the token retrieval process multiple times.
Compare the results with the same process on an Android device.
Observations:
iOS devices (both simulator and real devices in release mode) consistently show 300-500ms retrieval times.
Android devices show an initial delay, but subsequent retrievals are much faster (1-10ms).
The slow retrieval on iOS persists even when fetching the same (presumably cached) token.
Test Environment:
iOS Version: 18.0
Tested on both iOS simulator and real devices in release mode
Firebase Core version
3.6.0
Flutter Version
3.24.3
Relevant Log Output
IOS
flutter: await FirebaseAppCheck.instance.getToken()
elapsedMilliseconds: 446ms
flutter: await FirebaseAppCheck.instance.getToken()
elapsedMilliseconds: 536ms
flutter: await FirebaseAppCheck.instance.getToken()
elapsedMilliseconds: 512ms
flutter: await FirebaseAppCheck.instance.getToken()
elapsedMilliseconds: 322ms
flutter: await FirebaseAppCheck.instance.getToken()
elapsedMilliseconds: 466ms
flutter: await FirebaseAppCheck.instance.getToken()
elapsedMilliseconds: 255ms
ANDROID
I/flutter ( 8473): await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473): elapsedMilliseconds: 87ms
I/flutter ( 8473):
I/flutter ( 8473): await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473): elapsedMilliseconds: 2ms
I/flutter ( 8473):
I/flutter ( 8473): await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473): elapsedMilliseconds: 1ms
await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473): elapsedMilliseconds: 1ms
I/flutter ( 8473):
I/flutter ( 8473): await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473): elapsedMilliseconds: 1ms
I/flutter ( 8473):
I/flutter ( 8473): await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473): elapsedMilliseconds: 20ms
I/flutter ( 8473):
I/flutter ( 8473): await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473): elapsedMilliseconds: 1ms
### Flutter dependencies
# firebase
firebase_core: 3.6.0
firebase_database: 11.1.4
firebase_messaging: 15.1.3
firebase_analytics: 11.3.3
firebase_app_check: 0.3.1+3
### Additional context and comments
This issue significantly impacts the performance of our app on iOS devices.
The stark difference between iOS and Android performance is concerning.
We've tested this on both the iOS simulator and real devices in release mode, with consistent results.
We're unsure if this is expected behavior for Firebase AppCheck on iOS or if it's an anomaly.
Any insights into the cause of this discrepancy or suggestions for improving token retrieval speed on iOS would be greatly appreciated.
If this is normal behavior, we'd like to understand why there's such a significant difference between iOS and Android performance.