尝试将 facebook Uri 上传到 Firebase 存储时出错 [英] Error when trying to upload facebook Uri to Firebase Storage

查看:25
本文介绍了尝试将 facebook Uri 上传到 Firebase 存储时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户使用 Facebook 登录(目前唯一的登录方式)并想发布一些内容时,我会运行一些代码先上传他们的个人资料图片,以便其他用户可以看到原始发布者是谁.似乎我可以获得用户的个人资料图片 Uri,例如(取自调试模式):https://graph.facebook.com/(FACEBOOKID)/picture?height=200&width=200&migration_overrides=%7Boctober_2012%3Atrue%7D

When users log in with Facebook (the only way to log in currently), and want to post something, I run some code to upload their profile picture first, so other users can see who the original poster is. It seems like I can get the user's profile picture Uri which is for example (taken from debug mode): https://graph.facebook.com/(FACEBOOKID)/picture?height=200&width=200&migration_overrides=%7Boctober_2012%3Atrue%7D

但是,当我跑步时:

StorageReference posterPicture = mStorage.child("UsersPictures").child(profile.facebookID);
        posterPicture.putFile(profile.profilePictureURI).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {...});

它抛出一个错误,说没有内容提供者"

It throws an error saying "no content provider"

W/System.err: java.io.FileNotFoundException: No content provider: https://graph.facebook.com/(FACEBOOKID)/picture?height=200&width=200&migration_overrides=%7Boctober_2012%3Atrue%7D

W/System.err: java.io.FileNotFoundException: No content provider: https://graph.facebook.com/(FACEBOOKID)/picture?height=200&width=200&migration_overrides=%7Boctober_2012%3Atrue%7D

错误代码:-13000,

Error Code: -13000,

HTTP 响应代码:0

HTTP Response Code: 0

谢谢

推荐答案

简短的回答是 URI 必须是您文件系统上的一个文件(您必须下载并重新上传它),或者您需要一个可以处理 HTTPS 方案文件的内容解析器.

The short answer is that the URI has to be a file on your file system (you have to download it and re-upload it), or you need a content resolver that can handle HTTPS scheme'ed files.

也就是说,我要问你的问题是:为什么?该文件已经托管在 Facebook 上并且可以通过该 URL 轻松检索,那么为什么要再次上传呢?您可以非常轻松地在 Firebase 实时数据库中存储和共享该 URL,无需支付托管在 Firebase 存储中的费用.

That said, my question to you is: why? The file is already hosted on Facebook and easily retrievable by that URL, so why upload it again? You can very easily store and share that URL in the Firebase Realtime Database, no need to pay to host in in Firebase Storage.

这篇关于尝试将 facebook Uri 上传到 Firebase 存储时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆