I am building an iOS app and using STTwitter library for twitter login.I'm facing a problem that after successful login web view is not call back to my app.
here is my code
- (IBAction)tweetLogin:(id)sender
{
self.twitter = [STTwitterAPI twitterAPIWithOAuthConsumerKey:@"dnqYU387efhsa3yjXe1iutTP73m"
consumerSecret:@"SrqwezPbjjoRsYDusdcb9238jbd23tFZmAdh2yNRompjRLd6WI"];
_loginStatusLabel.text = @"Trying to login with Safari...";
_loginStatusLabel.text = @"";
[_twitter postTokenRequest:^(NSURL *url, NSString *oauthToken) {
NSLog(@"-- url: %@", url);
NSLog(@"-- oauthToken: %@", oauthToken);
TwitterLoginWebView *webViewVC = [self.storyboard instantiateViewControllerWithIdentifier:@"TwitterLoginWebView"];
[self presentViewController:webViewVC animated:YES completion:^{
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webViewVC.webView loadRequest:request];
}];
} authenticateInsteadOfAuthorize:NO
forceLogin:@(YES)
screenName:nil
oauthCallback:@"myapp://twitter_access_tokens/"
errorBlock:^(NSError *error) {
_loginStatusLabel.text = [error localizedDescription];
}];
self.twitter = [STTwitterAPI twitterAPIWithOAuthConsumerKey:@"dnqY237jbdfsyjXe1iutTP73m"
consumerSecret:@"SrqwezPbjjasb43nfkjsd0yJkJtFZmAdh2yNRompjRLd6WI"];
[_twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
[_twitter getUsersShowForUserID:nil orScreenName:@"barackobama" includeEntities:nil successBlock:^(NSDictionary *user) {
NSString *profileImageURLString = [user valueForKey:@"profile_image_url"];
NSURL *url = [NSURL URLWithString:profileImageURLString];
// UIImage *profileImage = [UIImage imageWithContentsOfURL:url];
} errorBlock:^(NSError *error) {
}];
} errorBlock:^(NSError *error) {
}];
}