not able to to move to next screen as soon as I get response from twitter login.
[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {
if (session) {
NSLog(@"signed in as %@", [session userName]);
NSString *userStr = [session userName];
NSString *userStr1 = [session userID];
UIStoryboard *strory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
phoneViewController *editobj = [strory instantiateViewControllerWithIdentifier:@"phoneViewController"];
[self presentViewController:editobj animated:YES completion:nil];
} else {
NSLog(@"error: %@", [error localizedDescription]);
}
UIStoryboard *strory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
phoneViewController *editobj = [strory instantiateViewControllerWithIdentifier:@"phoneViewController"];
[self presentViewController:editobj animated:YES completion:nil];
}];
You should execute all interface-related tasks only in the main queue. So simply dispatch your view controllers transition to it:
[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {
if (session) {
NSLog(@"signed in as %@", [session userName]);
NSString *userStr = [session userName];
NSString *userStr1 = [session userID];
dispatch_async(dispatch_get_main_queue(), ^{
UIStoryboard *strory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
phoneViewController *editobj = [strory instantiateViewControllerWithIdentifier:@"phoneViewController"];
[self presentViewController:editobj animated:YES completion:nil];
});
} else {
NSLog(@"error: %@", [error localizedDescription]);
}
}];