Flutter app crashes when opening a screen with a query in firestore/Storage only in iOS

armstrong

I have a flutter app, and in one screen, I'm getting content from storage and firestore. With this code I'm able to see a list of links from firestore

myScreen.dart
//I have another method similar to this to show the content inside folders (read below)
loadBasicStructure(submenu ,callback, context){
    return FutureBuilder(
      future: ctrl.loadMain(submenu),
      builder: (ctx, snapshot) {
        if (snapshot.connectionState == ConnectionState.waiting) {
          return Center(child: CircularProgressIndicator());
        } else if (snapshot.error != null) {
          print(snapshot.error);
          return Center(child: Text('Error'));
        } else {
          return ListView.separated(
            separatorBuilder: (context, index) {
              return Divider();
            },
            itemCount: snapshot.data.length,
            itemBuilder: (ctx, i) {
              ItemLab item = snapshot.data[i];
              print(item);
              return ListTile(
                  leading: setIconLab(item),
                  title: Text(setText(item)),
                  trailing: Icon(Icons.chevron_right),
                  onTap: () async {
                      //mycode
                    }
                  },
                );
            },
          );
        }
      },
    );
  }
controller.dart

Future<List<ItemLab>> loadLab(String submenu) async {
    var snapshot = await _storage.ref().child(submenu);
    var ret = await snapshot.listAll();
    List<ItemLab> content = [];
    ret.prefixes.forEach((element) {
      content add(
        Item(
          type: 'FOLDER',
          elemento: element,
        ),
      );
    });

    ret.items.forEach((element) {
      print(element);
      conteudo.add(
        ItemLab(
          type: 'FILE',
          element: element,
        ),
      );
    });

    try{
      await databaseReference
          .collection("${submenu}_url")
          .get()
          .then((snapshot)  {

        snapshot.docs.forEach((f) async => {
          f.data().isNotEmpty ?
            content.add(
              Item(
                type: 'VIDEO',
                element: null,
                video: f.data(),
              ),
            )
          :
            null

        });
      });

      await databaseReference
          .collection("${submenu}_url")
          .doc("Folder")
          .collection("RESET")
          .get()
          .then((snap){
        snap.docs.isNotEmpty ? conteudo.add(
          Item(
              type: FOLDER',
              folderVideo: "RESET"
          ),
        ) : null;
      });

    }catch(e){
      print(e);
    }


    return Future.value(content);
  }

How this code works:

I have a screen with a list of submenus EX ("submenu1, submenu2"). Inside it I check in storage if in that folder ("submenu1") it has some files and if yes I show in a list, if has not I check if there are folders inside this one ("submenu1 > RESET"). If it exists I show the folder.

I do this exact check too in firestore (because there I store some links from youtube). In this case the error is throwing because I have another screen with only items from firestore (and with the same structure) and it works normally, but in the submenu "photos" when I click in the folder "RESET" the app crashes and show this error:

2021-02-01 09:28:22.129581-0300 Runner[391:22847] An error occurred while parsing query arguments, this is most likely an error with this SDK. (
    0   CoreFoundation                      0x0000000189afb9ec F3021642-E3C0-33F8-9911-DD303A6056D0 + 1157612
    1   libobjc.A.dylib                     0x000000019de81b54 objc_exception_throw + 56
    2   Runner                              0x00000001023cddf0 _ZN8firebase9firestore4util16ObjcThrowHandlerENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 304
    3   Runner                              0x00000001023cd90c _ZN8firebase9firestore4util5ThrowENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 20
    4   Runner                              0x00000001023dfcf8 _ZN8firebase9firestore4util20ThrowInvalidArgumentIJNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEmEEEvPKcDpRKT_ + 48
    5   Runner                              0x00000001023b8238 _ZN8firebase9firestore3api19CollectionReferenceC2ENS0_5model12ResourcePathENSt3__110shared_ptrINS1_9FirestoreEEE + 716
    6   Runner                              0x00000001023e6684 _ZN8firebase9firestore3api9Firestore13GetCollectionERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE + 104
    7   Runner                              0x00000001023fc0a4 -[FIRFirestore collectionWithPath:] + 112
    8   Runner                              0x00000001025319b4 -[FLTFirebaseFirestoreReader FIRQuery] + 344
    9   Runner                              0x0000000102531428 -[FLTFirebaseFirestoreReader readValueOfType:] + 1272
    10  Flutter                             0x0000000103914130 Flutter + 5685552
    11  Runner                              0x0000000102530fdc -[FLTFirebaseFirestoreReader readValueOfType:] + 172
    12  Flutter                             0x000000010391564c Flutter + 5690956
    13  Flutter                             0x00000001039121dc Flutter + 5677532
    14  Flutter                             0x00000001033d9f9c Flutter + 204700
    15  Flutter                             0x00000001036b1d88 Flutter + 3186056
    16  Flutter                             0x00000001033e342c Flutter + 242732
    17  Flutter                             0x00000001033e53a0 Flutter + 250784
    18  CoreFoundation                      0x0000000189a7c3e0 F3021642-E3C0-33F8-9911-DD303A6056D0 + 635872
    19  CoreFoundation                      0x0000000189a7bfe4 F3021642-E3C0-33F8-9911-DD303A6056D0 + 634852
    20  CoreFoundation                      0x0000000189a7b4c4 F3021642-E3C0-33F8-9911-DD303A6056D0 + 632004
    21  CoreFoundation                      0x0000000189a75850 F3021642-E3C0-33F8-9911-DD303A6056D0 + 608336
    22  CoreFoundation                      0x0000000189a74ba0 CFRunLoopRunSpecific + 572
    23  GraphicsServices                    0x00000001a07dd598 GSEventRunModal + 160
    24  UIKitCore                           0x000000018c3662f4 CC6E5AC7-8248-35F6-8B42-2E25C93DCF0A + 11723508
    25  UIKitCore                           0x000000018c36b874 UIApplicationMain + 164
    26  Runner                              0x000000010239af80 main + 64
    27  libdyld.dylib                       0x0000000189753568 0B475C78-3C12-3121-B7F8-2B95B83DAF44 + 5480
)
2021-02-01 09:28:22.130980-0300 Runner[391:22847] -[NSNull getDocumentsWithSource:completion:]: unrecognized selector sent to instance 0x1d9269ee0
2021-02-01 09:28:22.132261-0300 Runner[391:22847] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull getDocumentsWithSource:completion:]: unrecognized selector sent to instance 0x1d9269ee0'
*** First throw call stack:
(0x189afb9d8 0x19de81b54 0x189a0bbbc 0x189afe01c 0x189afff8c 0x102530514 0x10252e9d0 0x103912224 0x1033d9f9c 0x1036b1d88 0x1033e342c 0x1033e53a0 0x189a7c3e0 0x189a7bfe4 0x189a7b4c4 0x189a75850 0x189a74ba0 0x1a07dd598 0x18c3662f4 0x18c36b874 0x10239af80 0x189753568)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull getDocumentsWithSource:completion:]: unrecognized selector sent to instance 0x1d9269ee0'
terminating with uncaught exception of type NSException

Expected behavior

I expect that when I tap in the folder inside submenu, it opens a list of links (like it do in the other submenu that only have storage files

I don't know if i'm being clear, if there are a question, tell me

Xcode Error Print

Ada Lovelassy

I had a similar problem, just drop the part you get content from firestore and see if it works... if yes, put it back. For some reason it might work

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

ios app crashes when screen is touched

From Dev

My app crashes when opening tablayout activity

From Dev

iPad App Crashes When Opening Share Sheet

From Dev

IOs App freezes at splash screen only when updated

From Dev

How to remove black screen when opening app

From Dev

iOS 7 Only App Crashes at Startup

From Dev

app crashes when opening another activity in Navigation Drawer

From Dev

Accessing NSProcessInfo.processInfo().environment in AppDelegate causing crash only when opening iOS app outside of Xcode

From Dev

Alamofire crashes only when running archived app

From Dev

App crashes when starting on iOS 5

From Dev

Framework code is exposed when app crashes - iOS

From Dev

iOS 9.1 Crashes App when Accessibility Inspector is On

From Dev

iOS app crashes when displaying SLComposeViewController

From Dev

app crashes when no iBeacon is detected - Swift iOS

From Dev

iOS 9.1 Crashes App when Accessibility Inspector is On

From Dev

iOS app crashes when loading an image

From Dev

Forms App crashes after splash screen on iOS device

From Dev

firefox shows only blank screen when opening new pdf

From Dev

firefox shows only blank screen when opening new pdf

From Dev

NSInvalidArgumentException: App crashes upon opening

From Dev

NSInvalidArgumentException: App crashes upon opening

From Dev

iOS simulator only shows app in a quarter of the screen

From Dev

iOS simulator only shows app in a quarter of the screen

From Dev

Black screen when opening app after a few hours of inactivity

From Dev

Flutter app when runs returns a blank screen

From Dev

App crashes when trying to display three panoramic photos on one screen

From Dev

App Crashes When Switching from Splash Screen to MainActivity

From Dev

android: app stops and then crashes when the screen goes off

From Dev

Internet Explorer crashes when opening

Related Related

  1. 1

    ios app crashes when screen is touched

  2. 2

    My app crashes when opening tablayout activity

  3. 3

    iPad App Crashes When Opening Share Sheet

  4. 4

    IOs App freezes at splash screen only when updated

  5. 5

    How to remove black screen when opening app

  6. 6

    iOS 7 Only App Crashes at Startup

  7. 7

    app crashes when opening another activity in Navigation Drawer

  8. 8

    Accessing NSProcessInfo.processInfo().environment in AppDelegate causing crash only when opening iOS app outside of Xcode

  9. 9

    Alamofire crashes only when running archived app

  10. 10

    App crashes when starting on iOS 5

  11. 11

    Framework code is exposed when app crashes - iOS

  12. 12

    iOS 9.1 Crashes App when Accessibility Inspector is On

  13. 13

    iOS app crashes when displaying SLComposeViewController

  14. 14

    app crashes when no iBeacon is detected - Swift iOS

  15. 15

    iOS 9.1 Crashes App when Accessibility Inspector is On

  16. 16

    iOS app crashes when loading an image

  17. 17

    Forms App crashes after splash screen on iOS device

  18. 18

    firefox shows only blank screen when opening new pdf

  19. 19

    firefox shows only blank screen when opening new pdf

  20. 20

    NSInvalidArgumentException: App crashes upon opening

  21. 21

    NSInvalidArgumentException: App crashes upon opening

  22. 22

    iOS simulator only shows app in a quarter of the screen

  23. 23

    iOS simulator only shows app in a quarter of the screen

  24. 24

    Black screen when opening app after a few hours of inactivity

  25. 25

    Flutter app when runs returns a blank screen

  26. 26

    App crashes when trying to display three panoramic photos on one screen

  27. 27

    App Crashes When Switching from Splash Screen to MainActivity

  28. 28

    android: app stops and then crashes when the screen goes off

  29. 29

    Internet Explorer crashes when opening

HotTag

Archive