TwitterKit is dismissing callee controller in airplane mode

ios
bug

#1

Consider this example

  let controller = /** Some modal controller */

 Twitter.sharedInstance().logIn(with: controller, completion: { (session, error) -> Void in
  })

If there’s no/bad internet connection /airplane mode, TwitterSDK will dismiss the controller immediately

Here are some call stacks which are showing that this call is made by the TwitterSDK itself

Potentially related issues:


#2

I’m having similar trouble- TwitterKit is dismissing my (modally presented) view controller which is invoking -[Twitter loginWithCompletion:] when the user cancels authentication in the SFSafariViewController via the ‘Done’ button.

iOS 11 & 10, Xcode 9b6 & 8.3.3
TwitterKit 3.1.1

Steps:

  1. My (modally presented) View Controller calls [[Twitter sharedInstance] loginWithCompletion:...]
  2. SFSafariViewController is presented to handle auth (simulator / no Twitter app)
  3. User taps Done in nav bar (cancels auth)
  4. My view controller is sent -dismissViewControllerAnimated:completion: from TwitterKit!

See backtrace:

* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 22.1
  * frame #0: 0x000000010fc4bfd2 Redacted`-[LoginViewController dismissViewControllerAnimated:completion:](self=0x00007fb64c9990b0, _cmd="dismissViewControllerAnimated:completion:", flag=YES, completion=(null)) at LoginViewController.m:78
    frame #1: 0x0000000110204036 Redacted`__43-[Twitter performWebBasedLogin:completion:]_block_invoke.275 + 70
    frame #2: 0x00000001101d0235 Redacted`-[TWTRWebAuthenticationFlow failWithError:] + 104
    frame #3: 0x00000001101d0031 Redacted`__68-[TWTRWebAuthenticationFlow presentWebAuthenticationViewController:]_block_invoke + 65
    frame #4: 0x00000001101eb74d Redacted`-[TWTRWebAuthenticationViewController failWithError:] + 282
    frame #5: 0x00000001101eb519 Redacted`-[TWTRWebAuthenticationViewController safariViewControllerDidFinish:] + 64
    frame #6: 0x0000000113b49b95 SafariServices`-[SFSafariViewController remoteViewControllerWillDismiss:] + 128
    frame #7: 0x0000000113b3bb1d SafariServices`-[SFBrowserRemoteViewController willDismissServiceViewController] + 47

From searching the forums it looks like similar problems have occurred in previous releases of TwitterKit.

Edit: It appears performWebBasedLogin:completion: is attempting to dismiss the SFSafariViewController on Done, but I suspect this is already handled by the SafariServices framework.

Please help!


iOS 11 - TwitterKit 3 - The presenting view controller dismisses on clicking Done button in the web top left
Double navigation bars
#3

Seeing the same thing. I tried passing nil as the viewController, or use the logIn method without a viewController parameter and had the same result.


#4

I’m having the same issue, please help !


#5

Same


#6

This is happening to me, the callee viewController is being dismissed if the app is not installed. Steps to reproduce:

  1. Make sure Twitter is no installed
  2. Call Twitter.sharedInstance().logIn(with: viewController)

TwitterKit logs the message and closes the callee vie controller:

<hash>
  <error>Desktop applications only support the oauth_callback value 'oob'</error>
  <request>/oauth/request_token</request>
</hash>
" UserInfo={NSLocalizedDescription=<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>Desktop applications only support the oauth_callback value 'oob'</error>
  <request>/oauth/request_token</request>
</hash>
}

#7

having the same issue …anyone got around it?
Im using TwitterKit 3


#8

Having the same issue and it’s driving me crazy.


#9

Seeing the same/similar thing right now. I am using TWTRComposerViewController, and on user tapping cancel in the UI, the calling vc is dismissed. It doesn’t happen if the calling vc is not presented modally.


#10

This issue doesn’t seem to be fixed yet, is there a workaround?