Skip to content

Instantly share code, notes, and snippets.

@premedios
Created September 1, 2014 22:37
Show Gist options
  • Save premedios/230382f7928678e31d84 to your computer and use it in GitHub Desktop.
Save premedios/230382f7928678e31d84 to your computer and use it in GitHub Desktop.
performSegueWithIdentifier not doing anything
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSDictionary *d = [self parametersDictionaryFromQueryString:[url query]];
//NSString *token = d[@"oauth_token"];
NSString *verifier = d[@"oauth_verifier"];
LoginViewController *loginViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"Twitter Login"];
[loginViewController doneTwitterLogin:YES];
[loginViewController setOAuthVerifier:verifier];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:loginViewController];
NSLog(@"%@", loginViewController.navigationController);
[loginViewController.navigationController performSegueWithIdentifier:@"User Info" sender:self];
// The above line generates an exception that navigationController doesn't have a segue named "User Info"
return YES;
}
- (IBAction)twitterLogin:(UIButton *)sender {
STTwitterAPI *twitter = [STTwitterAPI twitterAPIWithOAuthConsumerKey:@"kQIEDlgYpejDPcB9a6xJ9Aqjg" consumerSecret:@"5MNUJcqyTBRZriHv7dCFyGP1BZSh3tf3A4vZYeFOTK7GU5KnKB"];
[twitter postTokenRequest:^(NSURL *url, NSString *oauthToken) {
[[UIApplication sharedApplication] openURL:url];
//[self performSegueWithIdentifier:@"User Info" sender:self];
// The above line works but the segue happens before switching to Safari to open the URL.
} authenticateInsteadOfAuthorize:NO forceLogin:@YES screenName:nil oauthCallback:@"tweepy://twitter_oauth" errorBlock:^(NSError *error) {
NSLog(@"Error!");
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment