DEV Community

WarsiH
WarsiH

Posted on

Error on accessing data from from Firebase Firestore in Flutter iOS

So, I've done lots of researching across the internet, have tried all the solutions I could think off: flutter clean, pod init, pod install pod update, updating the security rules, and also re-adding the Google Services plist file multiple times through Xcode, editing AppDelegate.swift and adding the proper code, making sure to ensurewidgetbinding and initializing the FirebaseApp in main, updating my firebase packages, but this error still keeps popping up when trying to access Firestore data. Firestore auth works fine though, and although my app doesn't work on a iOS simulator, it works perfectly find on Android simulator.

I've been facing this issue from a number of days.

The key issue is: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: threads > 1'

Here are more details of the stack log:

2021-04-13 13:52:31.821705-0700 Runner[19143:118021] *** Assertion failure in static std::unique_ptr firebase::firestore::util::Executor::CreateConcurrent(const char , int)(), /(my app path)/ios/Pods/FirebaseFirestore/Firestore/core/src/util/executor_libdispatch.mm:368 2021-04-13 13:52:31.914078-0700 Runner[19143:118021] ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: threads > 1' *** First throw call stack: ( 0 CoreFoundation 0x00007fff20422ff2 exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff20193ff5 objc_exception_throw + 48 2 CoreFoundation 0x00007fff20422e1b +[NSException raise:format:] + 0 3 Foundation 0x00007fff20774a20 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166 4 FirebaseFirestore 0x0000000102cb2107 _ZN8firebase9firestore4util16ObjcThrowHandlerENS1_13ExceptionTypeEPKcS4_iRKNSt3112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 343 5 FirebaseFirestore 0x0000000102cb1665 ZN8firebase9firestore4util5ThrowENS1_13ExceptionTypeEPKcS4_iRKNSt3112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 53 6 FirebaseFirestore 0x0000000102e06d7d _ZN8firebase9firestore4util8internal13FailAssertionEPKcS4_iRKNSt3112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 45 7 FirebaseFirestore 0x0000000102e06e31 ZN8firebase9firestore4util8internal13FailAssertionEPKcS4_iRKNSt3112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEES4 + 177 8 FirebaseFirestore 0x0000000102cb465e _ZN8firebase9firestore4util8Executor16CreateConcurrentEPKci + 94 9 FirebaseFirestore 0x0000000102e4afe7 _ZN8firebase9firestore5local26LevelDbRemoteDocumentCacheC2EPNS1_18LevelDbPersistenceEPNS1_15LocalSerializerE + 327 10 FirebaseFirestore 0x0000000102e4b165 _ZN8firebase9firestore5local26LevelDbRemoteDocumentCacheC1EPNS1_18LevelDbPersistenceEPNS1_15LocalSerializerE + 37 11 FirebaseFirestore 0x0000000102e44bc7 ZN4absl14lts_2020_02_2511make_uniqueIN8firebase9firestore5local26LevelDbRemoteDocumentCacheEJPNS4_18LevelDbPersistenceEPNS4_15LocalSerializerEEEENS0_15memory_internal16MakeUniqueResultIT_E6scalarEDpOT0 + 103 12 FirebaseFirestore 0x0000000102e44788 _ZN8firebase9firestore5local18LevelDbPersistenceC2ENSt3110unique_ptrIN7leveldb2DBENS3_14default_deleteIS6_EEEENS0_4util4PathENS3_3setINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_4lessISI_EENSG_ISI_EEEENS1_15LocalSerializerERKNS1_9LruParamsE + 536 13 FirebaseFirestore 0x0000000102e4446d _ZN8firebase9firestore5local18LevelDbPersistenceC1ENSt3110unique_ptrIN7leveldb2DBENS3_14default_deleteIS6_EEEENS0_4util4PathENS3_3setINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_4lessISI_EENSG_ISI_EEEENS1_15LocalSerializerERKNS1_9LruParamsE + 29 14 FirebaseFirestore 0x0000000102e439a4 _ZN8firebase9firestore5local18LevelDbPersistence6CreateENS0_4util4PathENS1_15LocalSerializerERKNS1_9LruParamsE + 932 15 FirebaseFirestore 0x0000000102e40260 _ZN8firebase9firestore5local13LevelDbOpener6CreateERKNS1_9LruParamsE + 640 16 FirebaseFirestore 0x0000000102d3715b _ZN8firebase9firestore4core15FirestoreClient10InitializeERKNS0_4auth4UserERKNS0_3api8SettingsE + 379 17 FirebaseFirestore 0x0000000102d4198d _ZZZN8firebase9firestore4core15FirestoreClient6CreateERKNS1_12DatabaseInfoERKNS0_3api8SettingsENSt3110shared_ptrINS0_4auth19CredentialsProviderEEENSB_INS0_4util8ExecutorEEENSB_INSF_10AsyncQueueEEENSA_10unique_ptrINS0_6remote24FirebaseMetadataProviderENSA_14default_deleteISM_EEEEEN3$_2clENSC_4UserEENKUlvE_clEv + 61 18 FirebaseFirestore 0x0000000102d4192d _ZNSt31L8invokeIRZZN8firebase9firestore4core15FirestoreClient6CreateERKNS3_12DatabaseInfoERKNS2_3api8SettingsENS_10shared_ptrINS2_4auth19CredentialsProviderEEENSC_INS2_4util8ExecutorEEENSC_INSG_10AsyncQueueEEENS_10unique_ptrINS2_6remote24FirebaseMetadataProviderENS_14default_deleteISN_EEEEEN3$2clENSD_4UserEEUlvE_JEEEDTclclsr3std31E7forwardIT_Efp_Espclsr3std31E7forwardIT0_Efp0_EEEOSV_DpOSW + 29 19 FirebaseFirestore 0x0000000102d418dd _ZNSt3128invoke_void_return_wrapperIvE6callIJRZZN8firebase9firestore4core15FirestoreClient6CreateERKNS5_12DatabaseInfoERKNS4_3api8SettingsENS_10shared_ptrINS4_4auth19CredentialsProviderEEENSE_INS4_4util8ExecutorEEENSE_INSI_10AsyncQueueEEENS_10unique_ptrINS4_6remote24FirebaseMetadataProviderENS_14default_deleteISP_EEEEEN3$2clENSF_4UserEEUlvE_EEEvDpOT + 29 20 FirebaseFirestore 0x0000000102d418ad _ZNSt3110function12alloc_funcIZZN8firebase9firestore4core15FirestoreClient6CreateERKNS4_12DatabaseInfoERKNS3_3api8SettingsENS_10shared_ptrINS3_4auth19CredentialsProviderEEENSD_INS3_4util8ExecutorEEENSD_INSH_10AsyncQueueEEENS_10unique_ptrINS3_6remote24FirebaseMetadataProviderENS_14default_deleteISO_EEEEEN3$_2clENSE_4UserEEUlvE_NS_9allocatorISU_EEFvvEEclEv + 29 21 FirebaseFirestore 0x0000000102d404de _ZNSt3110function6funcIZZN8firebase9firestore4core15FirestoreClient6CreateERKNS4_12DatabaseInfoERKNS3_3api8SettingsENS_10shared_ptrINS3_4auth19CredentialsProviderEEENSD_INS3_4util8ExecutorEEENSD_INSH_10AsyncQueueEEENS_10unique_ptrINS3_6remote24FirebaseMetadataProviderENS_14default_deleteISO_EEEEEN3$_2clENSE_4UserEEUlvE_NS_9allocatorISU_EEFvvEEclEv + 30 22 FirebaseFirestore 0x0000000102c1b685 _ZNKSt3110function12value_funcIFvvEEclEv + 53 23 FirebaseFirestore 0x0000000102c18c75 _ZNKSt318functionIFvvEEclEv + 21 24 FirebaseFirestore 0x0000000102c18bda _ZN8firebase9firestore4util10AsyncQueue15ExecuteBlockingERKNSt318functionIFvvEEE + 186 25 FirebaseFirestore 0x0000000102c1da71 _ZZN8firebase9firestore4util10AsyncQueue4WrapERKNSt318functionIFvvEEEENK3$_0clEv + 33 26 FirebaseFirestore 0x0000000102c1da2d _ZNSt31L8invokeIRZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$0JEEEDTclclsr3std31E7forwardIT_Efp_Espclsr3std31E7forwardIT0_Efp0_EEEOSC_DpOSD + 29 27 FirebaseFirestore 0x0000000102c1d9dd _ZNSt3128invoke_void_return_wrapperIvE6callIJRZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$0EEEvDpOT + 29 28 FirebaseFirestore 0x0000000102c1d9ad _ZNSt3110function12alloc_funcIZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0NS_9allocatorISB_EES7_EclEv + 29 29 FirebaseFirestore 0x0000000102c1c72e _ZNSt3110function6funcIZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0NS_9allocatorISB_EES7_EclEv + 30 30 FirebaseFirestore 0x0000000102c1b685 _ZNKSt3110function12value_funcIFvvEEclEv + 53 31 FirebaseFirestore 0x0000000102c18c75 _ZNKSt3_18functionIFvvEEclEv + 21 32 FirebaseFirestore 0x000000010303ed15 _ZN8firebase9firestore4util4Task17ExecuteAndReleaseEv + 229 33 FirebaseFirestore 0x0000000102cb308d _ZN8firebase9firestore4util19ExecutorLibdispatch11InvokeAsyncEPv + 29 34 libdispatch.dylib 0x000000010952374e _dispatch_client_callout + 8 35 libdispatch.dylib 0x0000000109529f9a _dispatch_lane_serial_drain + 796 36 libdispatch.dylib 0x000000010952ac67 _dispatch_lane_invoke + 436 37 libdispatch.dylib 0x0000000109536a7a _dispatch_workloop_worker_thread + 872 38 libsystem_pthread.dylib 0x00007fff60250499 _pthread_wqthread + 314 39 libsystem_pthread.dylib 0x00007fff6024f467 start_wqthread + 15 ) libc++abi: terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: threads > 1' terminating with uncaught exception of type NSException CoreSimulator 757.3 - Device: iPhone 12 (B161D373-CDF3-4E02-A510-A7B855E99FBD) - Runtime: iOS 14.5 (18E5164d) - DeviceType: iPhone 12 (lldb)

Here is my flutter doctor -v results as well if needed:

[✓] Flutter (Channel stable, 2.0.5-0.0.pre.1, on macOS 11.2.3 20D91 darwin-x64, locale en-US) • Flutter version 2.0.5-0.0.pre.1 at /Users/hassanwarsi/Desktop/flutter • Framework revision c63b72218f (6 days ago), 2021-04-07 22:46:48 -0700 • Engine revision 2dce47073a • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/hassanwarsi/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode-beta.app/Contents/Developer • Xcode 12.5, Build version 12E5244e • CocoaPods version 1.10.1

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.55.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0

[✓] Connected device (1 available) • iPhone 12 (mobile) • B161D373-CDF3-4E02-A510-A7B855E99FBD • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator) ! Doctor found issues in 1 category.

Top comments (0)