【发布时间】:2021-03-06 07:57:01
【问题描述】:
当我尝试在我的 Firebase 存储中获取我的文件的下载 URL 时,我一直收到此错误,我不知道问题出在哪里,我尝试了很多方法
Exception has occurred.
FirebaseException ([firebase_storage/object-not-found] No object exists at the desired reference.)
W/StorageUtil(32618): no auth token for request
W/NetworkRequest(32618): no auth token for request
E/StorageException(32618): StorageException has occurred.
E/StorageException(32618): Object does not exist at location.
E/StorageException(32618): Code: -13010 HttpResult: 404
这是我的存储规则
service firebase.storage {
match /{allPaths=**} {
allow read;
}
}
这是我的代码
return GridView.builder(
shrinkWrap: true,
itemCount: snapshot.data.documents.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisSpacing: 20,
mainAxisSpacing: 20,
childAspectRatio: 1.7,
crossAxisCount:2),
itemBuilder: (BuildContext context, int index) {
checkItems = FirebaseFirestore.instance
.collection('items');
checkItems = checkItems..where('id',isEqualTo: user_id.toString());
DocumentSnapshot thesnapshot = snapshot.data.docs[index];
printUrl() async {
Reference ref =
FirebaseStorage.instance.ref().child('antivirus.jpg');
var togo = (await ref.getDownloadURL()).toString();
setState(() {
url = togo;
print('here is your url duuuuuuuuuuuuuuuuuuuuuudreeeeeeeeee'+url);
});
}
printUrl()
.................................................. ..................................................... .....................................
【问题讨论】:
-
您能否:1) 更新代码以记录
thesnapshot.data()['image'].toString()的值? 2) 在您的问题中包含更新后的代码及其输出? -
我更新了我的代码,thesnapshot.data()['image'] 的值是 'antvirus.jpg' ,我把这个文件保存在我的云存储数据库中
-
它给了我在代码开头写的同样的错误
-
这与your previous question btw 有何不同?
-
代码中的哪一行给出了错误?
标签: android firebase flutter dart firebase-storage