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. 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:
- (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
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];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.