SHARE
TWEET

Untitled

a guest Aug 13th, 2016 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  ViewController.swift
  3. //  testProjectforFirebase
  4. //
  5. //  Created by Jacob Platin on 8/11/16.
  6. //  Copyright © 2016 Jacob Platin. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10. import Firebase
  11.  
  12. class ViewController: UIViewController {
  13.  
  14.     @IBOutlet weak var profileChangeLabel: UILabel!
  15.  
  16.     @IBOutlet weak var button: UIButton!
  17.    
  18.  
  19.     override func viewDidLoad() {
  20.         super.viewDidLoad()
  21.         // Do any additional setup after loading the view, typically from a nib.
  22.    
  23.     }
  24.  
  25.  
  26.     override func didReceiveMemoryWarning() {
  27.         super.didReceiveMemoryWarning()
  28.         // Dispose of any resources that can be recreated.
  29.     }
  30.  
  31.     @IBAction func myButton(sender: UIButton) {
  32.         print("BUTTON PRESS")
  33.        
  34.         FIRAuth.auth()?.signInWithEmail("sam@example.com", password: "sam1234", completion: { (user, error) in
  35.             print(error)
  36.            
  37.             user?.profileChangeRequest().photoURL = NSURL(string: "Hometown")
  38.             user?.profileChangeRequest().commitChangesWithCompletion({ error in
  39.                 print("COMPLETION")
  40.                 if let error = error {
  41.                     // An error happened.
  42.                     print("ERROR")
  43.                     print(error)
  44.                 } else {
  45.                     // Profile updated.
  46.                     print("SUCCESS")
  47.                     let user = FIRAuth.auth()?.currentUser
  48.                     print(user)
  49.                     print(user?.email)
  50.                 }
  51.             })
  52.         })
  53.        
  54.     }
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top