firebase / flutterfire

πŸ”₯ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.7k stars 3.97k forks source link

πŸ› [firebase_core] Firebase crashes on iOS #5856

Closed CEO-CGS closed 2 years ago

CEO-CGS commented 3 years ago

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 for a number of days now.

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<Executor> 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_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 343
    5   FirebaseFirestore                   0x0000000102cb1665 _ZN8firebase9firestore4util5ThrowENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 53
    6   FirebaseFirestore                   0x0000000102e06d7d _ZN8firebase9firestore4util8internal13FailAssertionEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 45
    7   FirebaseFirestore                   0x0000000102e06e31 _ZN8firebase9firestore4util8internal13FailAssertionEPKcS4_iRKNSt3__112basic_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 _ZN8firebase9firestore5local18LevelDbPersistenceC2ENSt3__110unique_ptrIN7leveldb2DBENS3_14default_deleteIS6_EEEENS0_4util4PathENS3_3setINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_4lessISI_EENSG_ISI_EEEENS1_15LocalSerializerERKNS1_9LruParamsE + 536
    13  FirebaseFirestore                   0x0000000102e4446d _ZN8firebase9firestore5local18LevelDbPersistenceC1ENSt3__110unique_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_3api8SettingsENSt3__110shared_ptrINS0_4auth19CredentialsProviderEEENSB_INS0_4util8ExecutorEEENSB_INSF_10AsyncQueueEEENSA_10unique_ptrINS0_6remote24FirebaseMetadataProviderENSA_14default_deleteISM_EEEEEN3$_2clENSC_4UserEENKUlvE_clEv + 61
    18  FirebaseFirestore                   0x0000000102d4192d _ZNSt3__1L8__invokeIRZZN8firebase9firestore4core15FirestoreClient6CreateERKNS3_12DatabaseInfoERKNS2_3api8SettingsENS_10shared_ptrINS2_4auth19CredentialsProviderEEENSC_INS2_4util8ExecutorEEENSC_INSG_10AsyncQueueEEENS_10unique_ptrINS2_6remote24FirebaseMetadataProviderENS_14default_deleteISN_EEEEEN3$_2clENSD_4UserEEUlvE_JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOSV_DpOSW_ + 29
    19  FirebaseFirestore                   0x0000000102d418dd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZZN8firebase9firestore4core15FirestoreClient6CreateERKNS5_12DatabaseInfoERKNS4_3api8SettingsENS_10shared_ptrINS4_4auth19CredentialsProviderEEENSE_INS4_4util8ExecutorEEENSE_INSI_10AsyncQueueEEENS_10unique_ptrINS4_6remote24FirebaseMetadataProviderENS_14default_deleteISP_EEEEEN3$_2clENSF_4UserEEUlvE_EEEvDpOT_ + 29
    20  FirebaseFirestore                   0x0000000102d418ad _ZNSt3__110__function12__alloc_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 _ZNSt3__110__function6__funcIZZN8firebase9firestore4core15FirestoreClient6CreateERKNS4_12DatabaseInfoERKNS3_3api8SettingsENS_10shared_ptrINS3_4auth19CredentialsProviderEEENSD_INS3_4util8ExecutorEEENSD_INSH_10AsyncQueueEEENS_10unique_ptrINS3_6remote24FirebaseMetadataProviderENS_14default_deleteISO_EEEEEN3$_2clENSE_4UserEEUlvE_NS_9allocatorISU_EEFvvEEclEv + 30
    22  FirebaseFirestore                   0x0000000102c1b685 _ZNKSt3__110__function12__value_funcIFvvEEclEv + 53
    23  FirebaseFirestore                   0x0000000102c18c75 _ZNKSt3__18functionIFvvEEclEv + 21
    24  FirebaseFirestore                   0x0000000102c18bda _ZN8firebase9firestore4util10AsyncQueue15ExecuteBlockingERKNSt3__18functionIFvvEEE + 186
    25  FirebaseFirestore                   0x0000000102c1da71 _ZZN8firebase9firestore4util10AsyncQueue4WrapERKNSt3__18functionIFvvEEEENK3$_0clEv + 33
    26  FirebaseFirestore                   0x0000000102c1da2d _ZNSt3__1L8__invokeIRZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOSC_DpOSD_ + 29
    27  FirebaseFirestore                   0x0000000102c1d9dd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0EEEvDpOT_ + 29
    28  FirebaseFirestore                   0x0000000102c1d9ad _ZNSt3__110__function12__alloc_funcIZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0NS_9allocatorISB_EES7_EclEv + 29
    29  FirebaseFirestore                   0x0000000102c1c72e _ZNSt3__110__function6__funcIZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0NS_9allocatorISB_EES7_EclEv + 30
    30  FirebaseFirestore                   0x0000000102c1b685 _ZNKSt3__110__function12__value_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.

Here is the code sample I try to run -

import 'dart:async';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:gig/services/database.dart';
import 'package:provider/provider.dart';

import 'models/user.dart';
import 'screens/wrapper.dart';

Future<void> main() async{
  WidgetsFlutterBinding.ensureInitialized();
  final FirebaseApp app = await Firebase.initializeApp();
    assert(app != null);
    print('Initialized default app $app');
  runApp(MyApp());}

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MultiProvider(providers:[ 
    StreamProvider<User>.value(
                  value: FirebaseAuth.instance.authStateChanges(),
                  initialData: FirebaseAuth.instance.currentUser
    ),
            StreamProvider<UserData>(
                  create: (context) => DatabaseService(uid:"${FirebaseAuth.instance.currentUser}").userData,
                 // initialData: FirebaseAuth.instance.currentUser
            )]
    , child:
            MaterialApp(
      home: Wrapper()
    ));
  }
}

Wrapper class -


    class Wrapper extends StatefulWidget {
      @override
      _WrapperState createState() => _WrapperState();
    }

    class _WrapperState extends State<Wrapper> {

      @override
      Widget build(BuildContext context) {
         while(Provider.of<User>(context)==null){return Loading();}
        print("user: ${Provider.of<User>(context)}");
        while( Provider.of<UserData>(context)==null){

          return Loading();
        }
        final user = Provider.of<User>(context);
        final userd = Provider.of<UserData>(context);
        return Container(child:Text("${userd.fname}")); 
      }
    } 
markusaksli-nc commented 3 years ago

Hi @CEO-CGS Please provide your flutter pub deps -- --style=compact. Thank you

CEO-CGS commented 3 years ago

Hello @markusaksli-nc. Thank you for your quick response. Here it is -


Flutter SDK 2.0.5-0.0.pre.1
gig 1.0.0+1

dependencies:
- cloud_firestore 0.16.0+1 [flutter meta quiver firebase_core firebase_core_platform_interface cloud_firestore_platform_interface cloud_firestore_web]
- cupertino_icons 1.0.2
- email_validator 2.0.1
- firebase_auth 0.20.1 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
- firebase_core 0.7.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_launcher_icons 0.9.0 [args image path yaml]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- archive 3.1.2 [crypto path]
- args 2.0.0
- async 2.5.0 [collection]
- boolean_selector 2.1.0 [source_span string_scanner]
- characters 1.1.0
- charcode 1.2.0
- clock 1.1.0
- cloud_firestore_platform_interface 3.0.2 [flutter meta collection firebase_core plugin_platform_interface]
- cloud_firestore_web 0.3.0+2 [flutter flutter_web_plugins http_parser meta firebase_core firebase_core_web cloud_firestore_platform_interface js]
- collection 1.15.0
- crypto 3.0.1 [collection typed_data]
- fake_async 1.2.0 [clock collection]
- firebase_auth_platform_interface 3.1.0 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.3 [flutter flutter_web_plugins meta http_parser intl firebase_core firebase_core_web firebase_auth_platform_interface js]
- firebase_core_platform_interface 3.0.1 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+3 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image 3.0.2 [archive meta xml]
- intl 0.16.1 [path]
- js 0.6.3
- matcher 0.12.10 [stack_trace]
- meta 1.3.0
- path 1.8.0
- petitparser 4.1.0 [meta]
- plugin_platform_interface 1.0.3 [meta]
- quiver 2.1.5 [matcher meta]
- sky_engine 0.0.99
- source_span 1.8.0 [charcode collection path term_glyph]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- string_scanner 1.1.0 [charcode source_span]
- term_glyph 1.2.0
- test_api 0.2.19 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0 [collection]
- vector_math 2.1.0
- xml 5.1.0 [collection meta petitparser]
- yaml 3.1.0 [collection source_span string_scanner]
`
markusaksli-nc commented 3 years ago

This seems like a pretty obscure error so not sure what exactly could be causing it at a glance. Could you try to see if the same issue persists on the latest version cloud_firestore: ^1.0.6?

Also it's unclear from the example you provided what part exactly could be causing the issue here. It would be really helpful if you could isolate the problem to just cloud_firestore or what other package with cloud_firestore causes the crash and provide a minimal complete reproducible code sample that we can run in main.dart to test as well.

CEO-CGS commented 3 years ago

I have tried using cloud_firestore ^1.0.6 and firebase_core: ^1.0.4 now. The error is still there, even when using those two packages only.

Here is the main.dart to test -


import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(title: "Hi",
    home: Scaffold(
      appBar: AppBar(title: const Text("lets try this!")),
      floatingActionButton: FloatingActionButton(
        onPressed: () => FirebaseFirestore.instance
        .collection('testing')
        .add({'timestamp': Timestamp.fromDate(DateTime.now())})
       ,
      child: Icon(Icons.add),
    ),
    body: StreamBuilder(
      stream: FirebaseFirestore.instance.collection('test').snapshots(),
      builder: (
        BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot
      ){
        if(!snapshot.hasData) return const SizedBox.shrink();
        return ListView.builder(
        itemCount: snapshot.data.docs.length,
        itemBuilder: (BuildContext context, int index){
          final docData = snapshot.data.docs[index].data();
          final dateTime = (docData['timestamp'] as Timestamp).toDate();

          return ListTile(
            title: Text(dateTime.toString())
          );
        });
      }

      )),
    );

  }}
Salakar commented 3 years ago

'FIRESTORE INTERNAL ASSERTION FAILED: threads > 1' @ened could this be a result of the event channel refactor perhaps? I only see a single named dispatch queue in use here so don't think it's related but you may have more visibility on this since the event channel work hence looping you in πŸ˜…

markusaksli-nc commented 3 years ago

Tried the provided code but didn't see a crash with

  firebase_core: ^1.1.0
  cloud_firestore: ^1.0.7
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '7.11.0'
flutter doctor -v ``` [βœ“] Flutter (Channel master, 2.3.0-1.0.pre.105, on macOS 11.2.3 20D91 darwin-arm, locale en-GB) β€’ Flutter version 2.3.0-1.0.pre.105 at /Users/nevercode/development/flutter_master β€’ Upstream repository https://github.com/flutter/flutter.git β€’ Framework revision 3eb5736134 (4 hours ago), 2021-04-27 07:49:08 -0400 β€’ Engine revision 9e4b4e23a3 β€’ Dart version 2.14.0 (build 2.14.0-47.0.dev) [βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.3) β€’ Android SDK at /Users/nevercode/Library/Android/sdk β€’ Platform android-30, build-tools 30.0.3 β€’ Java binary at: /Users/nevercode/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7199119/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.app/Contents/Developer β€’ Xcode 12.5, Build version 12E262 β€’ CocoaPods version 1.10.1 [βœ“] Chrome - develop for the web β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [βœ“] Android Studio (version 4.1) β€’ Android Studio at /Users/nevercode/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7199119/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) [βœ“] Connected device (3 available) β€’ Nevercode’s iPhone (mobile) β€’ b668e524315069f3db3661ac11ff1f66afafebdb β€’ ios β€’ iOS 14.4.2 β€’ macOS (desktop) β€’ macos β€’ darwin-arm64 β€’ macOS 11.2.3 20D91 darwin-arm β€’ Chrome (web) β€’ chrome β€’ web-javascript β€’ Google Chrome 90.0.4430.93 β€’ No issues found! ```
ened commented 3 years ago

Hi @CEO-CGS could you please share more details, for example the package.lock file in your project. Also, please share a few details on how the problem can be reproduced. I will try to look at the issues using the FIXED versions specified above, first; but obviously want to avoid double work.

ened commented 3 years ago

hi @CEO-CGS I was not able to reproduce this error at all. Please find the sample project here: https://github.com/ened/flutterfire_5856

If you can modify it to crash, then we can take another detail look, else voting to close this ticket.

CEO-CGS commented 3 years ago

Hello. I download and tried running the sample project provided. In my case it did crash. I went through the following steps before running the project though: I updated the signing section in Xcode, I changed the bundle id and google-services-info.plist file. I did flutter upgrade, pod repo update, pod update, edited the build targets and then I ran it. This is the error that shows up. (Maybe it is slightly different than before?)


2021-05-01` 15:39:07.302285-0700 Runner[6696:63298] Metal API Validation Enabled
2021-05-01 15:39:07.360304-0700 Runner[6696:63298] MTLCreateSystemDefaultDevice() zero devices
2021-05-01 15:39:08.167198-0700 Runner[6696:63596] flutter: Observatory listening on http://127.0.0.1:50437/1hwF7lBxVOM=/
2021-05-01 15:39:08.470688-0700 Runner[6696:63580] 7.3.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
2021-05-01 15:39:12.530871-0700 Runner[6696:63581] *** Assertion failure in static std::unique_ptr<Executor> firebase::firestore::util::Executor::CreateConcurrent(const char *, int)(), /Users/hassanwarsi/Downloads/flutterfire_5856-main/ios/Pods/FirebaseFirestore/Firestore/core/src/util/executor_libdispatch.mm:368
2021-05-01 15:39:12.609938-0700 Runner[6696:63581] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: threads > 1'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff20422fba __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007fff20193ff5 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff20422de3 +[NSException raise:format:] + 0
    3   Foundation                          0x00007fff207749b0 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    4   FirebaseFirestore                   0x00000001014eda27 _ZN8firebase9firestore4util16ObjcThrowHandlerENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 343
    5   FirebaseFirestore                   0x00000001014ecf85 _ZN8firebase9firestore4util5ThrowENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 53
    6   FirebaseFirestore                   0x000000010164269d _ZN8firebase9firestore4util8internal13FailAssertionEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 45
    7   FirebaseFirestore                   0x0000000101642751 _ZN8firebase9firestore4util8internal13FailAssertionEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEES4_ + 177
    8   FirebaseFirestore                   0x00000001014eff7e _ZN8firebase9firestore4util8Executor16CreateConcurrentEPKci + 94
    9   FirebaseFirestore                   0x0000000101686907 _ZN8firebase9firestore5local26LevelDbRemoteDocumentCacheC2EPNS1_18LevelDbPersistenceEPNS1_15LocalSerializerE + 327
    10  FirebaseFirestore                   0x0000000101686a85 _ZN8firebase9firestore5local26LevelDbRemoteDocumentCacheC1EPNS1_18LevelDbPersistenceEPNS1_15LocalSerializerE + 37
    11  FirebaseFirestore                   0x00000001016804e7 _ZN4absl14lts_2020_02_2511make_uniqueIN8firebase9firestore5local26LevelDbRemoteDocumentCacheEJPNS4_18LevelDbPersistenceEPNS4_15LocalSerializerEEEENS0_15memory_internal16MakeUniqueResultIT_E6scalarEDpOT0_ + 103
    12  FirebaseFirestore                   0x00000001016800a8 _ZN8firebase9firestore5local18LevelDbPersistenceC2ENSt3__110unique_ptrIN7leveldb2DBENS3_14default_deleteIS6_EEEENS0_4util4PathENS3_3setINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_4lessISI_EENSG_ISI_EEEENS1_15LocalSerializerERKNS1_9LruParamsE + 536
    13  FirebaseFirestore                   0x000000010167fd8d _ZN8firebase9firestore5local18LevelDbPersistenceC1ENSt3__110unique_ptrIN7leveldb2DBENS3_14default_deleteIS6_EEEENS0_4util4PathENS3_3setINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_4lessISI_EENSG_ISI_EEEENS1_15LocalSerializerERKNS1_9LruParamsE + 29
    14  FirebaseFirestore                   0x000000010167f2c4 _ZN8firebase9firestore5local18LevelDbPersistence6CreateENS0_4util4PathENS1_15LocalSerializerERKNS1_9LruParamsE + 932
    15  FirebaseFirestore                   0x000000010167bb80 _ZN8firebase9firestore5local13LevelDbOpener6CreateERKNS1_9LruParamsE + 640
    16  FirebaseFirestore                   0x0000000101572a7b _ZN8firebase9firestore4core15FirestoreClient10InitializeERKNS0_4auth4UserERKNS0_3api8SettingsE + 379
    17  FirebaseFirestore                   0x000000010157d2ad _ZZZN8firebase9firestore4core15FirestoreClient6CreateERKNS1_12DatabaseInfoERKNS0_3api8SettingsENSt3__110shared_ptrINS0_4auth19CredentialsProviderEEENSB_INS0_4util8ExecutorEEENSB_INSF_10AsyncQueueEEENSA_10unique_ptrINS0_6remote24FirebaseMetadataProviderENSA_14default_deleteISM_EEEEEN3$_2clENSC_4UserEENKUlvE_clEv + 61
    18  FirebaseFirestore                   0x000000010157d24d _ZNSt3__1L8__invokeIRZZN8firebase9firestore4core15FirestoreClient6CreateERKNS3_12DatabaseInfoERKNS2_3api8SettingsENS_10shared_ptrINS2_4auth19CredentialsProviderEEENSC_INS2_4util8ExecutorEEENSC_INSG_10AsyncQueueEEENS_10unique_ptrINS2_6remote24FirebaseMetadataProviderENS_14default_deleteISN_EEEEEN3$_2clENSD_4UserEEUlvE_JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOSV_DpOSW_ + 29
    19  FirebaseFirestore                   0x000000010157d1fd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZZN8firebase9firestore4core15FirestoreClient6CreateERKNS5_12DatabaseInfoERKNS4_3api8SettingsENS_10shared_ptrINS4_4auth19CredentialsProviderEEENSE_INS4_4util8ExecutorEEENSE_INSI_10AsyncQueueEEENS_10unique_ptrINS4_6remote24FirebaseMetadataProviderENS_14default_deleteISP_EEEEEN3$_2clENSF_4UserEEUlvE_EEEvDpOT_ + 29
    20  FirebaseFirestore                   0x000000010157d1cd _ZNSt3__110__function12__alloc_funcIZZN8firebase9firestore4core15FirestoreClient6CreateERKNS4_12DatabaseInfoERKNS3_3api8SettingsENS_10shared_ptrINS3_4auth19CredentialsProviderEEENSD_INS3_4util8ExecutorEEENSD_INSH_10AsyncQueueEEENS_10unique_ptrINS3_6remote24FirebaseMetadataProviderENS_14default_deleteISO_EEEEEN3$_2clENSE_4UserEEUlvE_NS_9allocatorISU_EEFvvEEclEv + 29
    21  FirebaseFirestore                   0x000000010157bdfe _ZNSt3__110__function6__funcIZZN8firebase9firestore4core15FirestoreClient6CreateERKNS4_12DatabaseInfoERKNS3_3api8SettingsENS_10shared_ptrINS3_4auth19CredentialsProviderEEENSD_INS3_4util8ExecutorEEENSD_INSH_10AsyncQueueEEENS_10unique_ptrINS3_6remote24FirebaseMetadataProviderENS_14default_deleteISO_EEEEEN3$_2clENSE_4UserEEUlvE_NS_9allocatorISU_EEFvvEEclEv + 30
    22  FirebaseFirestore                   0x0000000101456fa5 _ZNKSt3__110__function12__value_funcIFvvEEclEv + 53
    23  FirebaseFirestore                   0x0000000101454595 _ZNKSt3__18functionIFvvEEclEv + 21
    24  FirebaseFirestore                   0x00000001014544fa _ZN8firebase9firestore4util10AsyncQueue15ExecuteBlockingERKNSt3__18functionIFvvEEE + 186
    25  FirebaseFirestore                   0x0000000101459391 _ZZN8firebase9firestore4util10AsyncQueue4WrapERKNSt3__18functionIFvvEEEENK3$_0clEv + 33
    26  FirebaseFirestore                   0x000000010145934d _ZNSt3__1L8__invokeIRZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOSC_DpOSD_ + 29
    27  FirebaseFirestore                   0x00000001014592fd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0EEEvDpOT_ + 29
    28  FirebaseFirestore                   0x00000001014592cd _ZNSt3__110__function12__alloc_funcIZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0NS_9allocatorISB_EES7_EclEv + 29
    29  FirebaseFirestore                   0x000000010145804e _ZNSt3__110__function6__funcIZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0NS_9allocatorISB_EES7_EclEv + 30
    30  FirebaseFirestore                   0x0000000101456fa5 _ZNKSt3__110__function12__value_funcIFvvEEclEv + 53
    31  FirebaseFirestore                   0x0000000101454595 _ZNKSt3__18functionIFvvEEclEv + 21
    32  FirebaseFirestore                   0x000000010187a635 _ZN8firebase9firestore4util4Task17ExecuteAndReleaseEv + 229
    33  FirebaseFirestore                   0x00000001014ee9ad _ZN8firebase9firestore4util19ExecutorLibdispatch11InvokeAsyncEPv + 29
    34  libdispatch.dylib                   0x0000000107cd374e _dispatch_client_callout + 8
    35  libdispatch.dylib                   0x0000000107cd9f9a _dispatch_lane_serial_drain + 796
    36  libdispatch.dylib                   0x0000000107cdac67 _dispatch_lane_invoke + 436
    37  libdispatch.dylib                   0x0000000107ce6a7a _dispatch_workloop_worker_thread + 872
    38  libsystem_pthread.dylib             0x00007fff6033f499 _pthread_wqthread + 314
    39  libsystem_pthread.dylib             0x00007fff6033e467 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.5 - Device: iPhone 12 (B161D373-CDF3-4E02-A510-A7B855E99FBD) - Runtime: iOS 14.5 (18E182) - DeviceType: iPhone 12
(lldb) ```
CEO-CGS commented 3 years ago

I also recently installed the most recent stable version of Xcode, and @markusaksli-nc, I tried running the sample project provided by @ened with the updated packages you provided but I received this error - 1. Did not find header 'FLTFirebasePluginRegistry.h' in framework 'FirebaseCore'

ened commented 3 years ago

@CEO-CGS seems to load just fine here:

2021-05-02 09:47:29.168440+0100 Runner[45690:5087602] Metal API Validation Enabled
2021-05-02 09:47:29.345977+0100 Runner[45690:5087602] Warning: Unable to create restoration in progress marker file
2021-05-02 09:47:29.369044+0100 Runner[45690:5088251] 7.3.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
2021-05-02 09:47:29.414015+0100 Runner[45690:5088285] flutter: Observatory listening on http://127.0.0.1:51218/2TM6xqTRAig=/

Could you give it a go to adjust the pubspec dependencies

 dependencies:
   cloud_firestore: 1.0.6
   firebase_core: 1.0.4
   flutter:
     sdk: flutter

Maybe remove firebase_core (comes through cloud_firestore) and use cloud_firestore: ^1.0.7, then do the flutter clean, flutter pub get flutter build ios dance and try again.

CEO-CGS commented 3 years ago

I tried removing firebase_core and used cloud_firestore 1.0.7, and did the steps, and I got another type of error... Here is a link to the entire 'build failed' message. I'm not too sure what the error here is - https://docs.google.com/document/d/1YuJSiwiIlfnk53EL9Km4ORgxWl4SUYi-oSKkryv-skE/edit?usp=sharing

ened commented 3 years ago

@CEO-CGS very strange - the error points to outdated cocoapods dependencies still. I have upgraded cloud_firestore dependency now and updated the repository. Please pull the new version from https://github.com/ened/flutterfire_5856.

Once pulled, please run git clean -xfd, then flutter pub get, cd ios && pod update && cd -, then try to build the App again on the command line: flutter build ios --debug --no-codesign.

CEO-CGS commented 3 years ago

@ened, unfortunately, this does not seem to fix it either. I went through all the steps provided, and here is the link to the full error message. I think it might be the same one, or similar - https://docs.google.com/document/d/1_IQKUjiilLzRRB9s1ZL6kwu0-7-Sz0hDXHyI5WOwpbw/edit?usp=sharing

ened commented 3 years ago

Can you try to remove your pods cache: rm -rf ~/Library/Caches/CocoaPods and then try again - I'm starting to wonder if you had a incomplete download or something like that. Once done, please do the git clean.. etc dance as above again. Thank you.

CEO-CGS commented 3 years ago

Hey @ened. Here are the results. https://docs.google.com/document/d/1ZV5lYJvb0RNha9zpSe2KkUVp0V52wxrXyeh1FXdPvj0/edit?usp=sharing Sadly, it still did not work. Please check my commands on the doc to see if I made the wrong commands and the full output.

CEO-CGS commented 3 years ago

Any solution yet?

CEO-CGS commented 3 years ago

Anything new anyone? Still hoping to use Firebase in one of my flutter projects....

russellwheatley commented 3 years ago

@CEO-CGS, Have you tried on a completely fresh application? By the way, the error suggests to me that you're initialising Firebase twice. So maybe double check you aren't initialising in your Swift code and Dart.

russellwheatley commented 2 years ago

Closing due to inactivity.