Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes on iOS 17.3+ #1045

Open
4 of 6 tasks
liri2006 opened this issue Apr 15, 2024 · 6 comments
Open
4 of 6 tasks

Crashes on iOS 17.3+ #1045

liri2006 opened this issue Apr 15, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@liri2006
Copy link

Environment

  • Output of flutter doctor
[√] Flutter (Channel stable, 3.16.9, on Microsoft Windows [Version 10.0.22631.3447], locale en-GB)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.17)
[!] Android Studio (version 2022.2)
    X Unable to determine bundled Java version.
[√] Android Studio (version 2023.1)
[√] VS Code (version 1.88.1)
[√] Connected device (4 available)
[√] Network resources
  • Version of purchases-flutter
    purchases_flutter: 6.19.0

  • Testing device version e.g.: iOS 15.5, Android API 30, etc.
    iOS 17.3.1, 17.4.1

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

Date/Time:           2024-04-10 16:17:25.8544 +0100
Launch Time:         2024-04-07 17:11:53.6814 +0100
OS Version:          iPhone OS 17.3.1 (21D61)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000019da1a3fc
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [13594]

Triggered by Thread:  0


Thread 0 name:
Thread 0 Crashed:
0   libswiftCore.dylib            	0x000000019da1a3fc _assertionFailure(_:_:file:line:flags:) + 264 (AssertCommon.swift:144)
1   PurchasesHybridCommon         	0x0000000101727bcc closure #1 in variable initialization expression of static FatalErrorUtil.defaultFatalErrorClosure + 64 (FatalErrorUtil.swift:15)
2   PurchasesHybridCommon         	0x000000010171fbb8 fatalError(_:file:line:) + 60 (FatalErrorUtil.swift:27)
3   PurchasesHybridCommon         	0x000000010171fbb8 static CommonFunctionality.sharedInstance.getter + 84 (CommonFunctionality.swift:21)
4   PurchasesHybridCommon         	0x000000010171fbb8 specialized static CommonFunctionality.logOut(completion:) + 352 (CommonFunctionality.swift:374)
5   PurchasesHybridCommon         	0x000000010171c15c @objc static CommonFunctionality.restorePurchases(completion:) + 76
6   purchases_flutter             	0x0000000101a82084 -[PurchasesFlutterPlugin logOutWithResult:] + 48 (PurchasesFlutterPlugin.m:320)
7   purchases_flutter             	0x0000000101a809f0 -[PurchasesFlutterPlugin handleMethodCall:result:] + 1468 (PurchasesFlutterPlugin.m:89)
8   Flutter                       	0x0000000104301a38  + -1 (:-1)
9   Flutter                       	0x0000000103d63c00  + -1 (:-1)
10  libdispatch.dylib             	0x00000001ac5a06a8 _dispatch_call_block_and_release + 32 (init.c:1530)
11  libdispatch.dylib             	0x00000001ac5a2300 _dispatch_client_callout + 20 (object.m:561)
12  libdispatch.dylib             	0x00000001ac5b0998 _dispatch_main_queue_drain + 984 (queue.c:7813)
13  libdispatch.dylib             	0x00000001ac5b05b0 _dispatch_main_queue_callback_4CF + 44 (queue.c:7973)
14  CoreFoundation                	0x00000001a45dcf9c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
15  CoreFoundation                	0x00000001a45d9ca8 __CFRunLoopRun + 1996 (CFRunLoop.c:3149)
16  CoreFoundation                	0x00000001a45d93f8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
17  GraphicsServices              	0x00000001e7b674f8 GSEventRunModal + 164 (GSEvent.c:2196)
18  UIKitCore                     	0x00000001a69ff8a0 -[UIApplication _run] + 888 (UIApplication.m:3685)
19  UIKitCore                     	0x00000001a69feedc UIApplicationMain + 340 (UIApplication.m:5270)
20  Runner                        	0x00000001009de038 main + 80 (main.m:7)
21  dyld                          	0x00000001c732edcc start + 2240 (dyldMain.cpp:1269)

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?

@liri2006 liri2006 added the bug Something isn't working label Apr 15, 2024
@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@liri2006
Copy link
Author

liri2006 commented May 3, 2024

Any thoughts on this? We still see few crashes a day even after updating to 6.26.0.

@mshmoustafa
Copy link
Contributor

Hey @liri2006 looks like the issue is in logging out, can you share a code snippet of how you log out?

@liri2006
Copy link
Author

liri2006 commented May 8, 2024

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();
    }
  }
}

@liri2006
Copy link
Author

@mshmoustafa what do you think?

@liri2006
Copy link
Author

liri2006 commented Jun 4, 2024

Any thoughts on what can cause this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants