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:
- My (modally presented) View Controller calls
[[Twitter sharedInstance] loginWithCompletion:...]
-
SFSafariViewController is presented to handle auth (simulator / no Twitter app)
- User taps
Done in nav bar (cancels auth)
- 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!