【问题标题】:NSInternalInconsistencyException when trying to list files in Firebase storage bucket尝试列出 Firebase 存储桶中的文件时出现 NSInternalInconsistencyException
【发布时间】:2019-08-19 19:22:48
【问题描述】:

我正在尝试使用以下代码获取我的 firebase 存储桶中所有对象的列表:

[listingReference listWithMaxResults:1000 completion:^(FIRStorageListResult * _Nonnull result, NSError * _Nullable error) {
        if(error != nil){
            NSLog(@"Error listing files");
            NSLog(@"%@", error);
        } else {
            NSArray<FIRStorageReference *> *entries = result.prefixes;
            NSArray<FIRStorageReference *> *entryItems = result.items;
            NSLog(@"List folder complete");
            NSLog(@"%@", entries);
            NSLog(@"%@", entryItems);
        }
    }];

但是,当我运行代码时,出现以下错误:

由于未捕获的异常而终止应用程序:

NSInternalInconsistencyException',原因:'预期 gs://bucketname1/ 是 gs://bucketname1/testfile 的子元素

我通过打印文件路径检查了我的listingReference,它输出了gs://bucketname1/,我认为这是正确的,因为我想列出存储桶中的所有文件。是不是我做错了什么?

【问题讨论】:

    标签: objective-c firebase firebase-storage


    【解决方案1】:

    在我看来,您实际上无法查询存储桶中的所有文件,因此我在存储桶内创建了一个文件夹并将我的文件保存在该文件夹中,并且可以在那里查询它们。

    【讨论】:

      猜你喜欢
      • 2016-11-01
      • 1970-01-01
      • 2020-07-09
      • 2022-10-14
      • 2020-01-24
      • 2017-01-11
      • 2017-07-01
      • 2022-11-21
      • 2016-09-29
      相关资源
      最近更新 更多