[BUG] Twitter kit iOS 3.0.4 login without Twitter App installed fails to call completion when no network connection


When authenticating with iOS Twitter kit 3.0.4 without the Twitter app installed, if there is no network connection, or the network connection is there but the endpoints Twitter kit is trying to call are unreachable, the completion block is never called. I would expect the completion block to be called with an error response to allow the app to update its UI. Steps

  1. Make sure the Twitter app is not installed
  2. Turn on Airplane mode on your device
  3. Call Twitter.sharedInstance().logIn(completion: )
  4. An error is logged to the console, but the completion handler is never called

2017-07-06 11:06:59.240360 TwitterAuthTest[914:106296] [TwitterKit] did encounter error with message “Error obtaining user auth token.”: Error Domain=TWTRLogInErrorDomain Code=-1 “” UserInfo={NSLocalizedDescription=}

Sample application: https://www.dropbox.com/s/j72ai6ckgx1p5g8/TwitterAuthTest2.zip?dl=0


Can you confirm this is a bug, and that it is being worked on please? I’d like to know if there will be an upcoming version of TwitterKit with a fix.


If the device has Twitter app installed, we get “User cancelled login from Twitter App”.
But on iOS 9, if the device doesn’t have Twitter thus pops up a webview, we do see your Auth token message.
We recognize that this is our bug, so we will have a fix on the next release.

Is this your situation? I’d like to capture full spec of the problem.


Sorry, I was not clear on the scenario. This bug happens when the Twiiter app is not installed. I’ve updated the above steps.

On iOS 9 or 10 if the Twitter app is not installed, then a network call is attempted. If there is no/bad network connection, this network call fails according to the console output, but the completion handler is not called indicating the error. I’m not seeing the webview coming up at all in this scenario. Seems like the network request is a prerequisite to the webview being displayed.

I have protection in my app against the user trying to authenticate when there is no network connection at all, but sometimes there is a network connection, but that connection can’t get out to anywhere, what I call a black hole network. In that case, I’ll allow the user to try to authenticate, but since the completion handler is never called, it leaves my UI in a bad state.


I can confirm that Twitter.sharedInstance().logIn does not return with an error (like we would expect it to) when it fails out due to network error. Tested on iOS 9.3.5, no Twitter app installed.


I just pulled down Twitter Kit 3.0.4 This bug still exists in that version.


This bug appears to be fixed in TwitterKit iOS 3.1.0, thanks!