簡體   English   中英

Flutter iOS 發布崩潰:Firebase FireStore Util

[英]Flutter iOS Release Crash: Firebase FireStore Util

我已經嘗試調試這個問題將近 8 天了。 嘗試了我在 inte.net / stack overflow / 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;
}

Flutter:3.3.9

發布規范:

Cloud Firestore : 4.1.0
Firebase Core: 2.3.0

任何幫助,將不勝感激!

我用盡了在線資源並提交了 +30 個版本來解決這個問題。

如果在執行查詢之前它們不為空,我設法通過對傳遞給 function 的參數添加條件檢查來修復它。

有點奇怪,因為上面的 function 甚至沒有在應用程序啟動時被調用,似乎 Swift 試圖在應用程序啟動和崩潰時調用 function 但在 Android 發布和兩種調試模式下,一切正常。

對於同一條船上的所有其他開發者,請從我的錯誤中吸取教訓

也謝謝Ali Nabel的幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM