Flutter iOS 应用程序在 App Store Review 中崩溃,但在 Testflight 设备上却没有崩溃

Luc*_*jee 7 ios dart firebase flutter app-store-connect

我用 Flutter 开发了一个应用程序,目前已在 App Store 上架,但是,一个多星期以来,我一直在尝试提交应用程序更新,并不断收到审核团队的回复:

We were unable to review your app as it crashed on launch. We have attached detailed crash logs to help troubleshoot this issue.
Review device details: 
- Device type: iPad
- OS version: iOS 14.6
Run Code Online (Sandbox Code Playgroud)

我尝试了很多方法来解决这个问题:将 Xcode pod 设置更新为推荐值、删除文件夹并再次进行 git 克隆、重新启动 mac 并重新提交 4 次,但均无济于事。

这是他们发给我的崩溃日志:

Incident Identifier: 74CF4E04-739B-4F7E-960B-F96B6EBFB5C0
CrashReporter Key:   4902311a005582d354e93e9b080db4578b96a328
Hardware Model:      xxx1
Process:             Roots [28779]
Path:                /private/var/containers/Bundle/Application/025BF194-3A5D-4FD2-AC67-ACDDA8E05906/Roots.app/Roots
Identifier:          live.roots.roots
Version:             96 (2.0.6)
AppStoreTools:       12E506
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           live.roots.roots [6515]


Date/Time:           2021-07-20 10:48:54.1315 +0200
Launch Time:         2021-07-20 10:48:24.2911 +0200
OS Version:          iPhone OS 14.6 (18F72)
Release Type:        User
Baseband Version:    n/a
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Application Specific Information:
abort() called

Last Exception Backtrace:
(0x19b59d298 0x1af2f7480 0x19b4ac2a8 0x19b59f8f4 0x19b5a189c 0x102a38cf0 0x107bd538c 0x1078e7690 0x107bee1a8 0x107b89f78 0x107b8bdf8 0x19b51d0f0 0x19b51ccf0 0x19b51c1c4 0x19b5164fc 0x19b515818 0x1b1c1b570 0x19de410e8 0x19de46664 0x102a2fe04 0x19b1f4140)

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001c6cca7b0 0x1c6ca3000 + 161712
1   libsystem_pthread.dylib         0x00000001e2ef89c0 0x1e2eee000 + 43456
2   libsystem_c.dylib               0x00000001a41c1a44 0x1a414e000 + 473668
3   libc++abi.dylib                 0x00000001af3d1be8 0x1af3bf000 + 76776
4   libc++abi.dylib                 0x00000001af3c3d14 0x1af3bf000 + 19732
5   libobjc.A.dylib                 0x00000001af2d79a0 0x1af2d1000 + 27040
6   libc++abi.dylib                 0x00000001af3d1074 0x1af3bf000 + 73844
7   libc++abi.dylib                 0x00000001af3d3c18 0x1af3bf000 + 85016
8   libobjc.A.dylib                 0x00000001af2f75d0 0x1af2d1000 + 157136
9   CoreFoundation                  0x000000019b515904 0x19b482000 + 604420
10  GraphicsServices                0x00000001b1c1b570 0x1b1c18000 + 13680
11  UIKitCore                       0x000000019de410e8 0x19d311000 + 11731176
12  UIKitCore                       0x000000019de46664 0x19d311000 + 11753060
13  Roots                           0x0000000102a2fe04 0x102a28000 + 32260
14  libdyld.dylib                   0x000000019b1f4140 0x19b1f3000 + 4416

Thread 1 name:  Dispatch queue: com.google.firebase.firestore
Thread 1:
0   libsystem_kernel.dylib          0x00000001c6ca6944 0x1c6ca3000 + 14660
1   libdispatch.dylib               0x000000019b177e20 0x19b174000 + 15904
2   libdispatch.dylib               0x000000019b17847c 0x19b174000 + 17532
3   Foundation                      0x000000019c7dda48 0x19c76a000 + 473672
4   Foundation                      0x000000019c7c86e0 0x19c76a000 + 386784
5   Foundation                      0x000000019c7c8444 0x19c76a000 + 386116
6   GoogleUtilities                 0x00000001058e58f0 0x1058dc000 + 39152
7   FirebaseCore                    0x0000000104d59d04 0x104d50000 + 40196
8   FirebaseCore                    0x0000000104d59e10 0x104d50000 + 40464
9   FirebaseFirestore               0x000000010514ff10 0x1050f4000 + 376592
10  FirebaseFirestore               0x0000000105180fec 0x1050f4000 + 577516
11  FirebaseFirestore               0x0000000105181a48 0x1050f4000 + 580168
12  FirebaseFirestore               0x0000000105228730 0x1050f4000 + 1263408
13  FirebaseFirestore               0x0000000105201ee8 0x1050f4000 + 1105640
14  FirebaseFirestore               0x0000000105203028 0x1050f4000 + 1110056
15  FirebaseFirestore               0x00000001050faa30 0x1050f4000 + 27184
16  FirebaseFirestore               0x0000000105212bfc 0x1050f4000 + 1174524
17  libdispatch.dylib               0x000000019b1d5298 0x19b174000 + 397976
18  libdispatch.dylib               0x000000019b17da40 0x19b174000 + 39488
19  libdispatch.dylib               0x000000019b17e518 0x19b174000 + 42264
20  libdispatch.dylib               0x000000019b187fac 0x19b174000 + 81836
21  libsystem_pthread.dylib         0x00000001e2ef95bc 0x1e2eee000 + 46524
22  libsystem_pthread.dylib         0x00000001e2efc86c 0x1e2eee000 + 59500

Thread 2 name:  com.apple.uikit.eventfetch-thread
Thread 2:
0   libsystem_kernel.dylib          0x00000001c6ca6908 0x1c6ca3000 + 14600
1   libsystem_kernel.dylib          0x00000001c6ca5d0c 0x1c6ca3000 + 11532
2   CoreFoundation                  0x000000019b51be00 0x19b482000 + 630272
3   CoreFoundation                  0x000000019b516200 0x19b482000 + 606720
4   CoreFoundation                  0x000000019b515818 0x19b482000 + 604184
5   Foundation                      0x000000019c772094 0x19c76a000 + 32916
6   Foundation                      0x000000019c771f74 0x19c76a000 + 32628
7   UIKitCore                       0x000000019deedc28 0x19d311000 + 12438568
8   Foundation                      0x000000019c8cedb0 0x19c76a000 + 1461680
9   libsystem_pthread.dylib         0x00000001e2ef7c74 0x1e2eee000 + 40052
10  libsystem_pthread.dylib         0x00000001e2efc878 0x1e2eee000 + 59512

Thread 3 name:  Dispatch queue: com.apple.FileCoordination.3
Thread 3:
0   libsystem_kernel.dylib          0x00000001c6ca6908 0x1c6ca3000 + 14600
1   libsystem_kernel.dylib          0x00000001c6ca5d0c 0x1c6ca3000 + 11532
2   libxpc.dylib                    0x00000001e2f2aef8 0x1e2f0d000 + 122616
3   libxpc.dylib                    0x00000001e2f2a9c4 0x1e2f0d000 + 121284
4   libxpc.dylib                    0x00000001e2f2a7e4 0x1e2f0d000 + 120804
5   libxpc.dylib                    0x00000001e2f0ebe8 0x1e2f0d000 + 7144
6   libsystem_trace.dylib           0x00000001b0f0c9f8 0x1b0f08000 + 18936
7   libdispatch.dylib               0x000000019b1d5298 0x19b174000 + 397976
8   libdispatch.dylib               0x000000019b17a5b8 0x19b174000 + 26040
9   libdispatch.dylib               0x000000019b17a4c8 0x19b174000 + 25800
10  libsystem_trace.dylib           0x00000001b0f0c4a4 0x1b0f08000 + 17572
11  libsystem_trace.dylib           0x00000001b0f17d98 0x1b0f08000 + 64920
12  libsystem_trace.dylib           0x00000001b0f17768 0x1b0f08000 + 63336
13  libsystem_trace.dylib           0x00000001b0f15d60 0x1b0f08000 + 56672
14  libsystem_trace.dylib           0x00000001b0f1bba8 0x1b0f08000 + 80808
15  Foundation                      0x000000019c94123c 0x19c76a000 + 1929788
16  CoreFoundation                  0x000000019b5a1a50 0x19b482000 + 1178192
17  CoreFoundation                  0x000000019b483750 0x19b482000 + 5968
18  Foundation                      0x000000019c97782c 0x19c76a000 + 2152492
19  Foundation                      0x000000019c77e5a0 0x19c76a000 + 83360
20  Foundation                      0x000000019c9790fc 0x19c76a000 + 2158844
21  libxpc.dylib                    0x00000001e2f254b8 0x1e2f0d000 + 99512
22  libxpc.dylib                    0x00000001e2f19bb0 0x1e2f0d000 + 52144
23  libdispatch.dylib               0x000000019b1d5318 0x19b174000 + 398104
24  libdispatch.dylib               0x000000019b18fe48 0x19b174000 + 114248
25  libdispatch.dylib               0x000000019b17d908 0x19b174000 + 39176
26  libdispatch.dylib               0x000000019b17e548 0x19b174000 + 42312
27  libdispatch.dylib               0x000000019b187fac 0x19b174000 + 81836
28  libsystem_pthread.dylib         0x00000001e2ef95bc 0x1e2eee000 + 46524
29  libsystem_pthread.dylib         0x00000001e2efc86c 0x1e2eee000 + 59500

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x00000001af3d4f09   x5: 0x000000016d3d73c0   x6: 0x000000000000006e   x7: 0xffffffffffffb749
    x8: 0x0000000104e2b880   x9: 0x62a636ca087527a0  x10: 0x0000000000000002  x11: 0x000000000000000b
   x12: 0x00000001e4b3ac4a  x13: 0x0000000000000000  x14: 0x0000000000000010  x15: 0x0000000000000000
   x16: 0x0000000000000148  x17: 0x0000000000000001  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x0000000000000103  x21: 0x0000000104e2b960  x22: 0x0000000000000001  x23: 0x0000000281344350
   x24: 0x0000000000000000  x25: 0x0000000000000001  x26: 0x0000000eb1e31100  x27: 0x00000001ebc75000
   x28: 0x0000000000000001   fp: 0x000000016d3d7330   lr: 0x00000001e2ef89c0
    sp: 0x000000016d3d7310   pc: 0x00000001c6cca7b0 cpsr: 0x40000000
   esr: 0x56000080  Address size fault
Run Code Online (Sandbox Code Playgroud)

由于Thread 1存在firebase/firestore,我认为这可能是我的 firebase 初始化时出现的问题main.dart,但我不知道如何解决这个问题。

这是我的 pubspec.yaml

name: roots
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.0.7+97

environment:
  sdk: ">=2.10.4 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  flutter_countdown_timer: null

  # The following adds the Cupertinwebo Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0
  cached_network_image: null
  mime: null
  sticky_headers: null
  url_launcher: null
  flutter_sound: ^8.0.0+6
  just_audio: null
  provider: null
  flutter_image_compress: null
  video_compress: null
  flutter_screenutil: null
  flutter_feather_icons: null
  google_fonts: null
  flutter_custom_dialog: null
  smooth_page_indicator: null
  giphy_picker: null
  signature: null
  path_provider: null
  intl: null
  uuid: null
  flutter_staggered_grid_view: null
  flick_video_player: null
  video_player: null
  carousel_slider: null

  purchases_flutter: ^2.0.0

  screenshot: null
  camera: ^0.8.1
  flutter_stories: null
  social_media_widgets: null
  timeago: null

  bubble: null
  hashtagable: null
  qr_flutter: null
  qr_code_scanner: ^0.4.0

  flutter_linkify: null

  focused_menu: null
  language_pickers: null

  number_display: null

  # Firebase dependencies (using old versions as new version break ios build)
  firebase_core: ^1.0.2
  cloud_firestore: ^1.0.3
  firebase_auth: ^1.0.1
  firebase_storage: ^8.0.1
  firebase_messaging: ^9.1.0
  cloud_functions: ^1.0.3
  paginate_firestore: ^0.3.1

  # Local Storage
  hive: ^2.0.0
  hive_flutter: ^1.0.0

  #Image and Video and Gallery
  image_picker: null
  file_picker: null
  flutter_absolute_path: null
  future_progress_dialog: null
  permission_handler: 5.0.1+2
  transparent_image: null

  overlay_support: null
  easy_localization: ^3.0.0
  visibility_detector: null

  expandable_text: null

  # Stories
  matrix_gesture_detector: null
  painter: null
  text_editor: null

  flutter_markdown: ^0.6.1
  flutter_svg: ^0.19.3

  get: ^4.1.3

  e3kit:
    git:
      url: git://github.com/lohQ/virgil-flutter-e3kit-extended.git
  share: ^2.0.1
  firebase_dynamic_links: ^2.0.2
  keyboard_visibility: ^0.5.6
  image: ^3.0.2
  network_image_to_byte: ^0.0.1
  receive_sharing_intent: ^1.4.5
  stream_transform: ^2.0.0
  ## Calling Functionality
  connectycube_sdk: ^2.0.0
  shared_preferences: ^2.0.0
  flutter_voip_push_notification: ^0.0.3
  flutter_call_kit:
    git:
      url: git://github.com/LucaJeevanjee/flutter_call_kit.git
      ref: master

  connectycube_flutter_call_kit: ^0.0.1-dev.1
  after_layout: ^1.1.0
  showcaseview: ^1.0.0
  flutter_app_badger: ^1.2.0
  simple_url_preview: ^3.0.1
  swipe_to: ^0.0.1+8
  collection: ^1.15.0
  screenshot_callback:
    git:
      url: git://github.com/LucaJeevanjee/flutter_screenshot_callback.git
      ref: master
  animated_splash_screen: null
  page_transition: null
  flutter_icons: ^1.1.0
  line_icons: ^2.0.1
  local_auth: ^1.1.6
  flutter_spinkit: ^5.0.0
  animate_do: ^2.0.0
  loader_overlay: ^2.0.2
  animations: ^2.0.0
  ripple_effect: ^0.1.1
  video_thumbnail: ^0.3.3
  flutter_contacts: ^1.1.0+3
  badges: ^2.0.1
  auto_size_text: ^2.1.0
  ringtone_player: null
  vibration: ^1.7.3
  device_id:
  #photo_manager: ^1.2.6+1

dependency_overrides:
  xml: ^5.0.0
  plugin_platform_interface: ^2.0.0
  uuid: ^3.0.1
  provider: ^5.0.0
  path_provider: ^2.0.0
  http: ^0.13.0

dev_dependencies:
  build_runner: ^1.10.11
  flutter_launcher_icons: ^0.9.0
  flutter_native_splash: null

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
flutter_icons:
  android: true
  ios: true
  image_path_android: "assets/icon/icon-roots-a.png"
  image_path_ios: "assets/icon/icon-roots.png"
  adaptive_icon_foreground: "assets/icon/icon-roots-a.png"
  adaptive_icon_background: "#00EE88"
  remove_alpha_ios: true

flutter_native_splash:
  color: "#E5E5E5"
  color_dark: "#1E1E1E"
  android: true
  ios: true
  image: "assets/icon/splash.png"
  image_dark: "assets/icon/splash.png"

# The following section is specific to Flutter.
flutter:
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true
  #fonts:
  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/icon/
    - assets/legislation/privacy.md
    - assets/legislation/tc.md
    - assets/illustrations/pngs/
  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.
  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages
  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages
Run Code Online (Sandbox Code Playgroud)

和我的 main.dart 以防我的设置出现问题

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil_init.dart';
import 'package:get/get.dart';
import 'package:get/get_navigation/get_navigation.dart';
import 'package:hive/hive.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:overlay_support/overlay_support.dart';
import 'package:provider/provider.dart';

import 'constants/boxes.dart';
import 'controllers/bindings/auth.dart';
import 'controllers/controllers.dart';
import 'routes.dart';
import 'services/audio/audio.dart';
import 'theme/colors.dart';
import 'theme/theme.dart';
import 'utils/open_boxes.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  try {
    await runInitialization();
    runApp(MyApp());
  } catch (error) {
    runApp(ErrorApp());
  }
}

runInitialization() async {
  await Firebase.initializeApp();
  await Hive.initFlutter();
  await openBoxes();

  Get.put(AuthController());
  Get.put<UserController>(UserController());
  Get.put<RelationshipController>(RelationshipController());
  Get.put<SettingsController>(SettingsController());
  Get.put(EncryptionController());
  Get.put(CodeController());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider<RecorderService>(
          create: (_) => RecorderService(),
        ),
        Provider<LocalPlayerService>(
          create: (_) => LocalPlayerService(),
        ),
        Provider<CloudPlayerService>(
          create: (_) => CloudPlayerService(),
        ),
        Provider<FileConverterService>(
          create: (_) => FileConverterService(),
        ),
      ],
      child: ScreenUtilInit(
        designSize: Size(375, 812),
        allowFontScaling: true,
        builder: () => ValueListenableBuilder(
            valueListenable: StorageBoxes.appearanceBox
                .listenable(keys: [StorageKeys.theme, StorageKeys.primary]),
            builder: (context, box, snapshot) {
              Color primary = Color(
                      box.get(StorageKeys.primary, defaultValue: defaultColor))
                  .withOpacity(1);

              int theme = box.get(StorageKeys.theme, defaultValue: 0);

              ThemeMode mode = theme == 0
                  ? ThemeMode.system
                  : theme == 1
                      ? ThemeMode.dark
                      : ThemeMode.light;

              return OverlaySupport(
                child: GetMaterialApp(
                  initialBinding: AuthBinding(),
                  title: 'Roots',
                  debugShowCheckedModeBanner: false,
                  initialRoute: '/',
                  getPages: AppRoutes.pages,
                  theme: AppTheme.getLightTheme(primary: primary),
                  darkTheme: AppTheme.getDarkTheme(primary: primary),
                  themeMode: mode,
                ),
              );
            }),
      ),
    );
  }
}

class ErrorApp extends StatelessWidget {
  final String error;
  const ErrorApp({Key key, this.error}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Color(jade).withOpacity(1),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Image.asset('assets/illustrations/pngs/subscribe.png', height: 125),
            SizedBox(height: 25),
            Text(
              'Whoops, something went wrong',
              textAlign: TextAlign.center,
              style: TextStyle(
                  fontSize: 25,
                  fontWeight: FontWeight.w600,
                  color: Colors.white),
            ),
            SizedBox(height: 12),
            Text(
              'This is a pretty rare bug! Try restarting the app or clearing the app data... sorry. We will be sure to investigate this bug.',
              textAlign: TextAlign.center,
              style: TextStyle(
                  fontSize: 17,
                  fontWeight: FontWeight.normal,
                  color: Colors.white