Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. [[FIRAuth auth] signInWithEmail:emailTxt.text
  2. password:pwdStr
  3. completion:^(FIRUser *user, NSError *error) {
  4. // ...
  5. NSLog(@"User: %@nUserEmail:%@nError:%@",user.uid,user.email,error);
  6. NSLog(user.isEmailVerified ? @"Verified = Yes" : @"Verified = No");
  7. [[NSUserDefaults standardUserDefaults] setObject:user.uid forKey:@"userid"];
  8.  
  9.  
  10. if(error == nil){
  11. if (user.isEmailVerified) {
  12.  
  13.  
  14. self.ref = [[FIRDatabase database] reference];
  15. NSString *userID = [FIRAuth auth].currentUser.uid;
  16.  
  17.  
  18. [[_ref child:[NSString stringWithFormat:@"users/user/%@",userID]] observeSingleEventOfType:FIRDataEventTypeValue withBlock:^(FIRDataSnapshot * _Nonnull snapshot) {
  19.  
  20. // Get user value
  21. NSLog(@"%@",snapshot.value);
  22. // ...
  23.  
  24.  
  25.  
  26. } withCancelBlock:^(NSError * _Nonnull error) {
  27. NSLog(@"%@", error.localizedDescription);
  28. }];
  29.  
  30.  
  31. }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement