Guest User

Untitled

a guest
Nov 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. let credential = FacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
  2. Auth.auth().signIn(with: credential, completion: {
  3. user, error in
  4. if error == nil {
  5. // Sign up successful
  6. // Save user's selected avatar image to our Firebase storage
  7. let firebaseStorage = Storage.storage().reference()
  8. let avatarImageReference = firebaseStorage.child((user?.uid)! + ".jpg")
  9. // Download profile picture from Facebook URL
  10. ImageDownloader.default.downloadImage(with: URL(string: profilePictureUrl.stringValue)!, options: [], progressBlock: nil, completionHandler: {
  11. image, error, url, data in
  12. let _ = avatarImageReference.putData(data!, metadata: nil) {
  13. metadata, error in
  14. if error == nil {
  15. // Success
  16. }
  17. }
  18. })
  19. }
  20. })
Add Comment
Please, Sign In to add comment