次のステップに進む前に、現在のユーザーがメールを確認したかどうかを確認しようとしています。私は何を間違っていますか助けてくださいありがとう。バックグラウンドでの電話番号の保存が機能します..「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];
}