- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
重要 : 我发现了同样的问题,但由于调试信息不完整而关闭。
我正在将图像上传到 firebase 存储,然后获取该图像的下载 URL 并将其存储到 firebase,以便我可以使用该 URL 使用网络图像显示用户的个人资料图像。
在我存储图像之前它工作正常
Reference storageRef = FirebaseStorage.instance.ref('images');
file = await _compressImage(file: file,);
await storageRef.putFile(file);
final String downloadUrl = await storageRef.child(id).getDownloadURL();
return downloadUrl;
但是在我将图像存储在特定文件夹中之后
Reference storageRef = FirebaseStorage.instance.ref('images');
file = await _compressImage(file: file, id: id);
await storageRef
.child(Get.find<UserController>().user.username)
.child(id)
.putFile(file);
final String downloadUrl = await storageRef.child(id).getDownloadURL();
return downloadUrl;
它显示此错误。
[firebase_storage/object-not-found] No object exists at the desired reference.
这是可解释的代码:
String newImage;
if (_controller.file != null) {
newImage = await Database().uploadFile(
file: _controller.file,
id: Get.find<UserController>().user.username);
print("new image: " + newImage.toString());
}
但是在这里,当我打印 newImage 的值时,它将 null 打印到控制台。
new image: null
这是将图像上传到 firebase 存储的第二种方法。
Future<String> uploadFile({@required File file, @required String id}) async {
try {
file = await _compressImage(file: file, id: id);
await storageRef
.child(Get.find<UserController>().user.username)
.child(id)
.putFile(file);
final String downloadUrl = await storageRef.child(id).getDownloadURL();
return downloadUrl;
} catch (e) {
print(e);
}
}
调试控制台:
E/StorageException(11376): StorageException has occurred.
E/StorageException(11376): Object does not exist at location.
E/StorageException(11376): Code: -13010 HttpResult: 404
E/StorageException(11376): { "error": { "code": 404, "message": "Not Found. Could not get object", "status": "GET_OBJECT" }}
E/StorageException(11376): java.io.IOException: { "error": { "code": 404, "message": "Not Found. Could not get object", "status": "GET_OBJECT" }}
E/StorageException(11376): at com.google.firebase.storage.network.NetworkRequest.parseResponse(NetworkRequest.java:434)
E/StorageException(11376): at com.google.firebase.storage.network.NetworkRequest.parseErrorResponse(NetworkRequest.java:451)
E/StorageException(11376): at com.google.firebase.storage.network.NetworkRequest.processResponseStream(NetworkRequest.java:442)
E/StorageException(11376): at com.google.firebase.storage.network.NetworkRequest.performRequest(NetworkRequest.java:272)
E/StorageException(11376): at com.google.firebase.storage.network.NetworkRequest.performRequest(NetworkRequest.java:286)
E/StorageException(11376): at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(ExponentialBackoffSender.java:70)
E/StorageException(11376): at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(ExponentialBackoffSender.java:62)
E/StorageException(11376): at com.google.firebase.storage.GetDownloadUrlTask.run(GetDownloadUrlTask.java:76)
E/StorageException(11376): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
E/StorageException(11376): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
E/StorageException(11376): at java.lang.Thread.run(Thread.java:764)
I/flutter (11376): [firebase_storage/object-not-found] No object exists at the desired reference.
I/flutter (11376): new image: null
但是当我检查 firebase 存储并且图像在那里成功上传时。
最佳答案
我因为与您和 IDK 相同的问题而损失了很多时间,但它是通过在使用之前创建引用来工作的:
final FirebaseStorage feedStorage =
FirebaseStorage.instanceFor(bucket: F.feedBucket);
Reference refFeedBucket = feedStorage
.ref()
.child('venues')
.child(auth.user.uid)
.child('vibes')
.child(p.basename(file.path));
String downloadUrl;
TaskSnapshot uploadedFile = await refFeedBucket.putFile(file);
if (uploadedFile.state == TaskState.success) {
downloadUrl = await refFeedBucket.getDownloadURL();
}
return downloadUrl;
关于firebase_storage object-not-found 在所需的引用 flutter 中不存在任何对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66068063/
重要 : 我发现了同样的问题,但由于调试信息不完整而关闭。 我正在将图像上传到 firebase 存储,然后获取该图像的下载 URL 并将其存储到 firebase,以便我可以使用该 URL 使用
我们如何在 Flutter 中监听文件上传到 Firebase 存储的进度? 最佳答案 如果你的上传功能是异步的,你可以这样做 StorageUploadTask putFile =
我正在尝试从 firebase firestore 获取图像,同时尝试获取图像下载 url 有以下异常: W/StorageUtil(10206):请求没有身份验证 token (类似问题与此错误并不
我正在尝试将 UInt8List 格式的图像上传到 firebase 存储。我正在使用“StorageReference.putData”。我不断收到此错误消息,指出未定义 putFile。我已经更新
以 Debug模式在 sdk gphone x86 上启动 lib\main.dart... 正在运行 Gradle 任务“assembleDebug”... 警告:插件 cloud_firestor
我是一名优秀的程序员,十分优秀!