Sharing with TwitterKit 3, iOS 11


I’ve managed to share a post successfully to twitter using TWTRComposer on iOS 11 using TwitterKit 3, but am unclear as to how authentication works. The first time I tried to share with TWTRComposer from my app, it launched me into Twitter to “Connect” my Twitter client application to my user account, then brought me back to my app, showing a dialog to complete my Tweet.

When I wanted to re-test that behaviour however, I revoked access for the app from my Twitter user account settings, thinking the “Connect” dialog would reappear, but it doesn’t. It just shows the tweet dialog, and upon trying to tweet, I get a “Tweet failed to send” error since the auth token is no longer valid.

How do I reset and get the Connect dialog to appear once more?


I was able to use the Twitter.sharedInstance() method to reset. However, is there a way to properly check if a session is no longer valid so that we can force a logout? Twitter.sharedInstance().sessionStore.hasLoggedInUsers() was returning true even though access was revoked.

Is this behaviour (not re-authenticating when access is revoked / not recognizing the session is invalid) a bug that’s expected to be addressed in a future TwitterKit release?