I am trying to login to user's Twitter account. I have followed the guide at https://dev.twitter.com/twitterkit/ios/installation to integrate Twitter.
However, when I try to login, nothing happens:
[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession * _Nullable session, NSError * _Nullable error) {
//not called
if(session && !error){
}else{
}
}];
I've also tried specifying view controller explicitly:
[[Twitter sharedInstance] logInWithViewController:self completion:^(TWTRSession * _Nullable session, NSError * _Nullable error) {
//again, not called.
if(session && !error){
}else{
}
}];
Twitter app itself is logged in and perfectly working with my account.
What am I doing wrong?
UPDATE: I've also tried on simulator (which, obviously, doesn't have the Twitter app) in addition to device (which has the Twitter app and a logged in account), it's the same on both scenarios.
Okay I've figured out the problem. I was mishandling UIApplication openURL:options:completionHandler:
method. My app was silently discarding the callback URL request. I've added a case for twitterauth
scheme and now it works perfectly.