如何使用Twitter数字框架在iOS中使用OTP进行多用户手机号码认证?
大家好,我正在使用我在我的应用程序中使用Objective-C、Parse和Twitters Digits框架,在一个用户会话中,应用程序将允许获取1个用户ID进行单个手机号码验证…我正在将其保存到Parse的当前用户的用户类中,并提供此详细信息。当我使用帐户登录时,应用程序将允许我使用OTP进行移动验证,但当我注销并使用另一个帐户登录时,应用程序将采用我存储在iPhone钥匙链中的现有用户id(手机号),当我使用多个帐户登录时,如何处理条件采用多个条件我的代码如下:如何使用Twitter数字框架在iOS中使用OTP进行多用户手机号码认证?,ios,objective-c,twitter-fabric,twitter-digits,Ios,Objective C,Twitter Fabric,Twitter Digits,大家好,我正在使用我在我的应用程序中使用Objective-C、Parse和Twitters Digits框架,在一个用户会话中,应用程序将允许获取1个用户ID进行单个手机号码验证…我正在将其保存到Parse的当前用户的用户类中,并提供此详细信息。当我使用帐户登录时,应用程序将允许我使用OTP进行移动验证,但当我注销并使用另一个帐户登录时,应用程序将采用我存储在iPhone钥匙链中的现有用户id(手机号),当我使用多个帐户登录时,如何处理条件采用多个条件我的代码如下: - (void)verif
- (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);
}
}];
}
我从apple docs获得了Twitter数字框架的解决方案 我只需在注销时使用以下行结束会话:
[[Digits sharedInstance] logOut];
@ZeMoon感谢您的编辑…我还没有得到数字文档中的详细信息,只是在搜索解决方案