firebase - 未处理的异常:[firebase_storage/object-not-found] 所需参考处不存在对象
问题描述
每当我尝试从 Firebase 存储中删除图像文件时,我都会收到此错误:
未处理的异常:[firebase_storage/object-not-found] 所需参考处不存在对象
我最近更新了所有的 firebase 包,从那以后我无法从 firebase 存储中删除图像
FirebaseStorage 中的文件夹 [![在此处输入图像描述][2]][2]
删除文件的代码。
deleteApartments(
PersonalApartment personalApartment, Function apartmentDeleted) async {
if (personalApartment.imageUrl != null) {
for (int i = 0; i < personalApartment.imageUrl.length; i++) {
Reference storageReference = FirebaseStorage.instance
.ref()
.child('/apartment_images')
.child(personalApartment.imageUrl[i]);
await storageReferences.delete();
}
} else {
FirebaseFirestore.instance
.collection('apartments')
.doc(personalApartment.id)
.delete();
apartmentDeleted(personalApartment);
}
FirebaseFirestore.instance
.collection('apartments')
.doc(personalApartment.id)
.delete();
apartmentDeleted(personalApartment);
print('images deleted');
}
调试控制台
2I/System.out(11910): (HTTPLog)-Static: isSBSettingEnabled false
E/StorageException(11910): StorageException has occurred.
E/StorageException(11910): Object does not exist at location.
E/StorageException(11910): Code: -13010 HttpResult: 404
E/StorageException(11910): { "error": { "code": 404, "message":
"Not Found. Could not delete object", "status": "DELETE_OBJECT" }}
E/StorageException(11910): java.io.IOException: { "error": { "code":
404, "message": "Not Found. Could not delete object", "status":
"DELETE_OBJECT" }}
E/flutter (11910): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)]
Unhandled Exception: [firebase_storage/object-not-found] No object
exists at the desired reference.
解决方案
推荐阅读
- javascript - 我只使用调度,React 抛出 Can't perform a React state update on an unmounted component
- .net - Copy-Item:该进程无法访问文件“dll”,因为它正被另一个进程使用
- excel - 如何在数据顺序不固定的情况下逐行比较 2 个 excel 工作表
- spring - 会话未在 Spring Session 中创建
- flutter - 如何解决 - SocketException:主机查找失败:'server.com'(操作系统错误:提供节点名或服务名,或未知,errno = 8)
- loops - 如何循环通过批量参数提供的目录?
- mysql - 具有关联列的 SQL 查询
- python-3.x - 如何在 Python3 中给参数一个接口?
- intellij-idea - 带有 IntelliJ 的 MX Master 3 - 后退/前进按钮导致多次跳转
- javascript - 管理 Rcon 远程 web rust 服务器