简体   繁体   English

如何使用Twitter Digit Framework在iOS中使用OTP进行多用户手机号码身份验证?

[英]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.

相关问题 使用iOS的twitter框架进行搜索 - Using the twitter framework for iOS to make a search 如何使用电话链接拨打IOS 6 7 8中的2位数电话号码 - How to call 2 digit phone number in IOS 6 7 8 using tel links 使用Swift 2和WindowsAzureMobileService.framework(客户端模式)在iOS客户端上实现Azure移动应用程序身份验证(通过Twitter) - Implementing Azure Mobile App Auth (with Twitter) on an iOS Client Using Swift 2 with WindowsAzureMobileService.framework (Client Side Mode) 如何指导用户使用Twitter.framework将他们的Twitter帐户添加到Twitter设置? - How can you direct a user to add their twitter account to twitter settings using Twitter.framework? 如何使用Mobile Safari中的链接使用Twitter应用程序打开用户的Twitter个人资料? - How do I open a user's Twitter profile using the Twitter app using a link in Mobile Safari? 使用iOS中的社交框架在Twitter上共享超链接 - Share hyperlink on twitter using socialize framework in iOS iOS:在Twitter上发布,而无需使用twitter.framework进行公开对话 - iOS : Post on twitter without open dialogue using twitter.framework 如何通过iOS在Twitter上发布多个帖子? - How to make multiple posts to Twitter via iOS? 如何使用 Swift 和 iOS 使用 Facebook 身份验证注销用户? - How to logout user using Facebook authentication using Swift and iOS? Azure移动应用程序服务Twitter身份验证iOS 9 - Azure Mobile App Service Twitter Authentication iOS 9
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM