我正在尝试检查当前用户是否在继续下一步之前验证了它的电子邮件。我在做什么错请帮助谢谢。在后台保存的电话号码有效..当我调用“SavePhoneInBackground”时,应用程序崩溃
(SVProgressHUd 是活动指标)
-(void) SavePhoneInBackground {
PFUser *user = [PFUser currentUser];
user[@"phone"] = _phone_register.text;
[user saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (!error) {
NSLog(@"PhoneUpdatingSucces!");
_phone_register.text = nil;
[self checkUserEmailVerify];
}else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Whoops!" message:@"Something went wrong! Try again." delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
[SVProgressHUD dismiss];
NSLog(@"There was an error in the registration!");
}
}];
}
-(void) checkUserEmailVerify {
PFUser *user = [PFUser currentUser];
if (![[user objectForKey:@"emailVerified"] boolValue]) {
// Refresh to make sure the user did not recently verify
[user refresh];
if (![[user objectForKey:@"emailVerified"] boolValue]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Whoops!" message:@"You need to verify your emailadress!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
return;
[SVProgressHUD dismiss];
}
}
// This is a triumph.
[SVProgressHUD dismiss];
[self performSegueWithIdentifier:@"login2" sender:self];
}