我是Firebase的新手,目前正在使用Firebase存储,并且已经成功上传了我的文件(问题不在这里).
问题在于获取上载文件的下载链接.
代码
Reference ref = FirebaseStorage.instance.ref('userImages/${FirebaseAuth.instance.currentUser?.uid}');
if(image != null){
ref = ref.child(Uri.file(image!.path).pathSegments.last);
var link = await ref.putFile(image!).snapshot.ref.getDownloadURL(); //this line generates error
// or even link = await ref.getDownloadURL();
ref = ref.parent!;
}
if(cover !=null){
ref = ref.child(Uri.file(cover!.path).pathSegments.last);
var link = await ref.putFile(cover!).snapshot.ref.getDownloadURL();
ref = ref.root;
}
E/StorageException(16989): StorageException has occurred.
E/StorageException(16989): Object does not exist at location.
E/StorageException(16989): 代码: -13010 HttpResult: 404
E/StorageException(16989): { "error": { "code": 404, "message": "Not Found." }}
E/StorageException(16989): java.io.IOException: { "error": { "code": 404, "message": "Not Found." }}
我认为推荐信指向了错误的地方,谢谢.