Open liri2006 opened 7 months ago
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
Any thoughts on this? We still see few crashes a day even after updating to 6.26.0.
Hey @liri2006 looks like the issue is in logging out, can you share a code snippet of how you log out?
Hey @mshmoustafa, we are just calling await Purchases.logOut(); in the bloc event (together with some other cleanup stuff). Here is a full event code:
import 'package:fms/common/common.dart';
import 'package:purchases_flutter/purchases_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
class Auth_LoggedOutEvent extends AuthEvent {
@override
Future<void> handle() async {
bloc.snackBarService.showModalLoading();
try {
await Future.wait([
bloc.authService.clearTokens(),
bloc.localStorage.remove(AuthBloc.currentUserIdKey),
]);
final prefs = await SharedPreferences.getInstance();
await Future.wait([
'language',
...FmsCacheKeys.clearable,
].map((x) => prefs.remove(x)));
await AppHomeWidgetService.setExpireProductsWidget(
<String, dynamic>{
AppHomeWidgetSharedPreferencesKeys.isLoggedIn: false,
AppHomeWidgetSharedPreferencesKeys.expiringProductsKey: null,
},
updateWidget: true,
);
await bloc.localNotificationsService.cancelAll();
await bloc.fcmService.resetInstanceId();
bloc.analyticsService.logLogout();
await Purchases.logOut();
await bloc.databaseService.clear();
bloc.databaseService.close();
} catch (e, st) {
Log.ex(tag, e, st);
} finally {
AuthState.initial()
.copyWith(
localDocumentsPath: bloc.state.localDocumentsPath,
)
.emit(this);
bloc.authService.setIsAuthenticated(false);
bloc.snackBarService.hideModalLoading();
}
}
}
@mshmoustafa what do you think?
Any thoughts on what can cause this?
Environment
[x] Output of
flutter doctor
[x] Version of
purchases-flutter
purchases_flutter: 6.19.0[x] Testing device version e.g.: iOS 15.5, Android API 30, etc. iOS 17.3.1, 17.4.1
[x] How often the issue occurs- every one of your customers is impacted? Only in dev? 1-6 crashes daily. On App Store released version only.
[ ] Debug logs that reproduce the issue
[ ] Steps to reproduce, with a description of expected vs. actual behavior Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
Crash report from the AppStore:
Describe the bug
I've noticed that for the last few weeks App Store Connect started reporting increased number of crashes. I've checked the crash log and the main one is provided above. Is it possible to figure out what is causing those crashes from that log?