大家好,我正在使用我在用户会话应用程序中的应用程序中使用 Objective-C、Parse 和 Twitters-Digits 框架将允许使用 1 个用户 ID 进行单个手机号码验证...我将其保存到 Parse 的当前用户的用户类中有了这个细节。当我使用帐户登录时,应用程序将允许我使用 OTP 进行移动验证,但是当我注销并使用另一个帐户登录时,应用程序将采用我存储在 iPhone 钥匙串中的现有用户 ID(手机号)当我登录时如何处理条件有多个帐户采取多种条件我的代码如下:
- (void)verifyPhone:(id)sender {
[[Digits sharedInstance] authenticateWithCompletion:^(DGTSession *session, NSError *error) {
// Inspect session/error objects
if (session.userID) {
// TODO: associate the session userID with your user model
PFUser *user = [PFUser currentUser];
[user setObject:[NSNumber numberWithBool:YES] forKey:@"mobileverify"];
[user saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded) {
NSString *msg = [NSString stringWithFormat:@"Phone number: %@", session.phoneNumber];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"You are logged in!" message:msg preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"OK", @"OK action")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
NSLog(@"Mobile Verification Status Saved Sucessfully.");
[verifyPhoneButton setTitle:@"Phone Verified" forState:UIControlStateNormal];
[verifyPhoneButton setEnabled:NO];
[verifyPhoneButton setTintColor:[UIColor blackColor]];
}];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
}
else {
NSLog(@"Error ==%@", error);
}
}];
} else if (error) {
NSLog(@"Authentication error: %@", error.localizedDescription);
}
}];
}