【问题标题】:How to make multiple user mobile number authentication using OTP in iOS using Twitter Digit Framework?如何使用 Twitter Digit Framework 在 iOS 中使用 OTP 进行多用户手机号码身份验证?
【发布时间】:2016-03-02 04:49:30
【问题描述】:

大家好,我正在使用我在用户会话应用程序中的应用程序中使用 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);
        }


    }];    
}

【问题讨论】:

  • @ZeMoon 感谢您的编辑...我在数字文档中没有详细信息,只是在寻找解决方案

标签: ios objective-c twitter-fabric twitter-digits


【解决方案1】:

我从 Apple 文档中获得了 Twitter-Digits Frameworks 的解决方案

https://docs.fabric.io/appledocs/Digits/Classes/Digits.html

我只需要在注销时使用以下行结束会话:

[[Digits sharedInstance] logOut];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-02-23
    • 2018-06-07
    • 1970-01-01
    • 1970-01-01
    • 2012-08-06
    • 2021-10-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多