[Bug][TwitterKit][iOS] - Dismissing SFSafariViewController with left edge swipe doesn't callback



Using version 2.4.0 of the TwitterKit SDK, when presenting the login view controller using the following:

Twitter.sharedInstance().logInWithViewController(viewController, methods: .WebBased) { ...

The SFSafariViewController is presented with what looks like a custom nav bar. Pressing “Cancel” works as expected and executes the callback block with the TWTRLogInErrorDomain TWTRLogInErrorCode.Canceled error.

However if I briefly drag my finger from the left side of the screen into the centre of the screen then I believe it is invoking the other dismiss gesture that is available within SFSafariViewController.

This however doesn’t get picked up by the SDK because the callback block is never executed :frowning:

In my use case, prior to presenting the loginViewController I put my view controller into a “busy” state where the login buttons are disabled because there is a brief delay between calling Twitter.sharedInstance().logInWithViewController and the view controller actually being presented, this allowed users to quickly press other buttons and glitch the app up. So now when the user accidentally performs a left to right swipe, they’re returned to my view controller still in this disabled state :confused:

If you are unable to provide a fix for this (I’m guessing something magical is being done to provide a custom nav bar in the view controller to handle the “Cancel” button callback) would it be possible to have some sort of additional callback to inform us when the login view controller is about to be presented?

Google do this in their Google Sign In SDK by providing us with a UI delegate that

  1. informs us when we should present spinners etc and
  2. allows us total control over presenting and dismissing the view controller that it provides.



Thanks for filing this excellent report, I’ll look into it with the team.


Hey any news about this? We shipped anyway hoping nobody would notice but have had a bug report filed now.


Hey @liamnichols,

No new news yet, but I’ll bring this back up internally.