[英]How to make multiple user mobile number authentication using OTP in iOS using Twitter Digit Framework?
Hello guys i am using i am using Objective-C, Parse and Twitters-Digits framework in my app in a users session app will allow to take 1 userid for single mobile number verification...i am saving it into Parse's current user's User Class with this details. 大家好,我正在使用我正在用户会话应用程序中的应用程序中使用Objective-C,Parse和Twitters-Digits框架,这将允许采用一个用户ID进行单个手机号码验证...我正在将其保存到Parse当前用户的User Class中详细信息。 when i login with an account app will allow to me for mobile verification using OTP but when i am logout and login with another account then app will take existing user id(Mobile no) which i stored in iPhone's keychain how to handled condition when i login with multiple accounts to take multiple condition my code is below: 当我使用帐户登录时,应用程序将允许我使用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);
}
}];
}
i got the solution from apple docs for Twitter-Digits Frameworks 我从苹果文档获得了Twitter-Digits框架的解决方案
https://docs.fabric.io/appledocs/Digits/Classes/Digits.html https://docs.fabric.io/appledocs/Digits/Classes/Digits.html
i just have to end up the Session at the time of logout with following line : 我只需要在注销时通过以下行结束会话:
[[Digits sharedInstance] logOut];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.