Flutter iOS发布崩溃:Firebase FireStore实用程序

v09wglhw  于 2022-12-14  发布在  Flutter
关注(0)|答案(1)|浏览(111)

我已经试着调试这个问题将近8天了。我试了所有我能在互联网上找到的东西/堆栈溢出/ github,仍然是同一个问题。我已经完成了所有的基本故障排除(清理,分解pod等),甚至通过Xcode添加了GoogleService-info.plist。
在调试模式和Android发布模式下没有问题。它只在iOS发布模式下的测试飞行和应用商店连接中发生,但在模拟器/调试模式下工作。以下是堆栈跟踪:

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

Application Specific Information:
abort() called

Last Exception Backtrace:
0   CoreFoundation                         0x1c8b25e88 __exceptionPreprocess + 164
1   libobjc.A.dylib                        0x1c1e538d8 objc_exception_throw + 60
2   FirebaseFirestore                      0x102f1bc08 firebase::firestore::util::ObjcThrowHandler(firebase::firestore::util::ExceptionType, char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 112
3   FirebaseFirestore                      0x102f1b78c firebase::firestore::util::Throw(firebase::firestore::util::ExceptionType, char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 20
4   FirebaseFirestore                      0x102f2284c void firebase::firestore::util::ThrowInvalidArgument<>(char const*) + 56
5   FirebaseFirestore                      0x102f4d3b4 -[FIRFirestore documentWithPath:] + 308
6   Runner                                 0x1023730c4 -[FLTFirebaseFirestoreReader readValueOfType:] + 2339012 (FLTFirebaseFirestoreReader.m:38)
7   Flutter                                0x10576d9c0 0x1051f4000 + 5740992
8   Runner                                 0x102373040 -[FLTFirebaseFirestoreReader readValueOfType:] + 2338880 (FLTFirebaseFirestoreReader.m:79)
9   Flutter                                0x10576ee54 0x1051f4000 + 5746260
10  Flutter                                0x10576bc8c 0x1051f4000 + 5733516
11  Flutter                                0x105237de4 0x1051f4000 + 277988
12  libdispatch.dylib                      0x1d00f44b4 _dispatch_call_block_and_release + 32
13  libdispatch.dylib                      0x1d00f5fdc _dispatch_client_callout + 20
14  libdispatch.dylib                      0x1d01047f4 _dispatch_main_queue_drain + 928
15  libdispatch.dylib                      0x1d0104444 _dispatch_main_queue_callback_4CF + 44
16  CoreFoundation                         0x1c8bb66f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
17  CoreFoundation                         0x1c8b98058 __CFRunLoopRun + 2036
18  CoreFoundation                         0x1c8b9ced4 CFRunLoopRunSpecific + 612
19  GraphicsServices                       0x201e9a368 GSEventRunModal + 164
20  UIKitCore                              0x1cb07b3d0 -[UIApplication _run] + 888
21  UIKitCore                              0x1cb07b034 UIApplicationMain + 340
22  Runner                                 0x10213dbe0 main + 23520 (AppDelegate.swift:5)
23  dyld                                   0x1e7204960 start + 2528

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib                 0x205720200 __pthread_kill + 8
1   libsystem_pthread.dylib                0x215b821ac pthread_kill + 268
2   libsystem_c.dylib                      0x1d01b13e4 __abort + 128
3   libsystem_c.dylib                      0x1d0159c98 abort + 192
4   libc++abi.dylib                        0x215ac2b8c abort_message + 132
5   libc++abi.dylib                        0x215ab2a80 demangling_terminate_handler() + 336
6   libobjc.A.dylib                        0x1c1e59d3c _objc_terminate() + 144
7   libc++abi.dylib                        0x215ac1f28 std::__terminate(void (*)()) + 20
8   libc++abi.dylib                        0x215ac1ec4 std::terminate() + 56
9   libdispatch.dylib                      0x1d00f5ff0 _dispatch_client_callout + 40
10  libdispatch.dylib                      0x1d01047f4 _dispatch_main_queue_drain + 928
11  libdispatch.dylib                      0x1d0104444 _dispatch_main_queue_callback_4CF + 44
12  CoreFoundation                         0x1c8bb66f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
13  CoreFoundation                         0x1c8b98058 __CFRunLoopRun + 2036
14  CoreFoundation                         0x1c8b9ced4 CFRunLoopRunSpecific + 612
15  GraphicsServices                       0x201e9a368 GSEventRunModal + 164
16  UIKitCore                              0x1cb07b3d0 -[UIApplication _run] + 888
17  UIKitCore                              0x1cb07b034 UIApplicationMain + 340
18  Runner                                 0x10213dbe0 main + 23520 (AppDelegate.swift:5)
19  dyld                                   0x1e7204960 start + 2528

下面的代码也会受到影响。我试着找出问题所在,当我注解docRef.get()方法时,它在试飞时不再崩溃:

Future<List<dbResults>> results({
  required String collectionKey,
  required String documentKey,
  required int count,
}) async {
  FirebaseFirestore firestore = FirebaseFirestore.instance;
  DocumentReference docRef =
      firestore.collection(collectionKey).doc(documentKey);
  List<dbResults> databaseResults = [];

  await docRef.get().then((datasnapshot) {
    if (datasnapshot.exists) {
      try {
        datbaseResults = datasnapshot.get('results');
        // Additional Logic Here which won't even matter as
        // it throws on docRef.get() itself (tried and tested)
        }
      } catch (_) {
        if (kDebugMode) {
          print("Error fetching game database results.");
        }
      }
    }
  });

  return databaseResults;
}

扑动:3.3.9
出版规范:

Cloud Firestore : 4.1.0
Firebase Core: 2.3.0

任何帮助都将不胜感激!
我已经用尽了网上的资源,并提交了+30构建只是为了解决这个问题。

pcww981p

pcww981p1#

我设法通过在执行查询之前对传递给函数的参数添加条件检查来修复它。
只是有点奇怪,因为上面的函数甚至没有被调用的应用程序启动,它似乎是斯威夫特试图调用该函数的应用程序启动和崩溃,但在Android发布和两个调试模式,一切正常。
对于所有其他在同一条船上的开发人员,请从我的错误中吸取教训
谢谢你的帮助!

相关问题