user278063
user278063

Reputation: 86

Upload Facebook image URL to Firebase Storage

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?

Upvotes: 2

Views: 1264

Answers (1)

Kyle Griffith
Kyle Griffith

Reputation: 114

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

Upvotes: 2

Related Questions