Firebase存储'listAll'返回错误'Expected gs:/bucketName to be a child element of gs:/bucketNamefileName'。

问题描述 投票:1回答:1

当使用 .listAll 检索存储桶根文件夹中的项目列表,我得到了以下错误。

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Expected gs:/MyBucketName to be a child element of gs:/MyBucketNamefilename'.

这种情况只发生在列出根文件夹时,而不是列出子文件夹时。该请求的调用如下。

// Storage Reference
let storageReference = Storage.storage().reference().root()

// List all items
storageReference.listAll { (result, error) in

    if let error = error {
        print(error.localizedDescription)
    }

    // Check what was found
    for item in result.items {
        print(item.name)
    }
}
swift firebase firebase-storage
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.