将Facebook图片网址上传到Firebase存储 [英] Upload Facebook image URL to Firebase Storage

查看:162
本文介绍了将Facebook图片网址上传到Firebase存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将用户脸书个人资料图片上传到Firebase存储。

  let dictionary = result as? NSDictionary 
let data = dictionary?.objectForKey(data)
let urlPic =(data?.objectForKey(url))!如!
print(urlPic)
print(urlPic)//直接链接到Facebook个人资料图片
print(将字符串转换成字符串)
print(\(urlPic))

上面的代码给了我facebook图片的网址。所以这一切都工作正常!

但是,一旦我有链接(URL)的图像我怎么会上传到Firebase存储?

解决方案

你不想发送一个url到存储。它只会在模拟器上工作,但显然它不能在设备上工作。所以你需要发送数据。看看这个链接。我不是流利的迅速,但我使它在objc版本工作,所以只需复制和粘贴和故障排除 https://github.com/firebase/quickstart-ios/blob/master/storage/StorageExampleSwift/ViewController.swift


I am trying to upload the users facebook profile picture to Firebase Storage.

let dictionary = result as? NSDictionary
let data = dictionary?.objectForKey("data")
let urlPic = (data?.objectForKey("url"))! as! String
print(urlPic) //Direct link to facebook profile picture
print("Down Casting to a string")
print("\(urlPic)")

The code above gives me the url to the facebook picture. So that is all working fine!

However, once I have the link(URL) to the image how would I go about uploading it to Firebase Storage?

解决方案

You don't want to send a url to the storage. it will only work on the emulator, but obviously it doesn't work on a device. so you need to send the data. Check out this link. I am not fluent in swift but i made it work in the objc version so just copy and paste and troubleshoot https://github.com/firebase/quickstart-ios/blob/master/storage/StorageExampleSwift/ViewController.swift

这篇关于将Facebook图片网址上传到Firebase存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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