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

查看:204
本文介绍了尝试将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:没有内容提供者: 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 方案的内容解析器'ed文件。

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 Storage中的主机支付费用。

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天全站免登陆