You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter iOS Release版本Firebase FireStore调用崩溃求助

iOS Release版本Firestore崩溃问题求助
  • 已调试该问题近8天,尝试过Stack Overflow、GitHub等所有能找到的解决方案,仍未解决
  • 已完成全部基础排查操作:清理项目、卸载Pods、通过Xcode添加GoogleService-info.plist等
  • 问题仅出现在iOS Release版本(TestFlight和App Store Connect环境),Debug模式、Android Release版本、iOS模拟器Debug模式均运行正常

崩溃堆栈跟踪

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()方法后,TestFlight版本不再崩溃,相关代码如下:

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

版本信息

  • Flutter: 3.3.9
  • Pubspec依赖:
    Cloud Firestore : 4.1.0
    Firebase Core: 2.3.0
    

已用尽网络资源,提交30多次构建仍未解决,恳请提供帮助!

内容的提问来源于stack exchange,提问作者mngkvn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 14:25:18