IOS API loginWithCompletion and logout


Hi all,
i am writing an app for an iPad that will be ‘kiosk’ based. I need to (1) present the user with a login dialog, (2) allow the input of a message (3)send the message (4)logout the user.
Currently, i can do (1), (2) and (3).
I attempt to logout the user by calling the logout function, but this seems incomplete, since the next time i come into my routine, the login dialog is not displayed - it uses my original login credentials.
Can someone tell me how I can completely log out the user via Objective-C in xCode?
Thank you,


Sorry but it is hard to help you, without any further information. Which Framework are you using? How are you trying to logout the user?


Sorry, i will try to be more thorough…

for login, I am using:

[[Twitter sharedInstance] logInWithCompletion:^
 (TWTRSession *session, NSError *error) {
     if (session) {
      <<< show a composer dialog >>>
      <<< send the tweet >>>

for logout, I am using

[[Twitter sharedInstance] logOut];

I am including

#import <TwitterKit/TwitterKit.h>

Does that help any?


Hint: Please indent code with 4 spaces, so it is displayed properly.

It seems you are using Fabric, I am not familiar with fabric so I can’t help you much. (And the category you have chosen is wrong, as this is framework-related and not REST API related)


Moved over to the Fabric category for more visibility!


now that it has been moved, can anyone assist me?


Actually I faced with the same issue on Fabric under Objective-C, need help of Fabric guru


actually, after a LOT of reading, it seems that i DO need the REST API and OAUTH to do what i need.
now gotta open a dialog back in REST1.1 to figure out how to use instead of in order to be able to send a picture with a status update…
thanks all,


Hi @jdubuke and @IhorA,

The incomplete logout issue you guys are facing is actually more related to iOS persisting system accounts. TwitterKit automatically logs a user in if they were already logged in on iOS. You can workaround this behavioral in the use case of kiosk with these steps:

  1. login to Twitter in system settings > Twitter
  2. Attempt to login using your app
  3. Disallow access to Twitter accounts when the grant access dialog comes up:

This prevents TwitterKit from accessing your system accounts and every user will have to login. Hope this helps!

Logout and switch user

Does anyone have a legitimate solution of how to effectively logout with Fabric? all of these threads lead to empty “solutions” that all revolve around the same answer of calling [[Twitter sharedInstance] logOut]; . Perhaps someone could show a code snippet or photo that is actually helpful


Check out this stack overflow answer. It has to do with the logOut method not clearing the app’s cookies.


Hello,friends I suggest one Of the best Solution for LogOut the Twitter Account using Fabric SDK for ios

- (IBAction)LogOut:(id)sender
    NSURL *url = [NSURL URLWithString:@""];
    NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:url];
    for (NSHTTPCookie *cookie in cookies)
        [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];


thank you for the response - luckily i already figured it out!


this not workin for me i am doing in Swift 3 and REST API 1.1

let store = Twitter.sharedInstance().sessionStore
if let userID = store.session()?.userID {

when i retrive it. without login but they found they dont logout

let client = TWTRAPIClient.withCurrentUser()


While this example is in Android, it may help as an example for you:


it doesnt work for me. i am not able to open twitter login page & it logs data for same user all the time…


hey, jay

can you please check you system login for twitter application ? if it is
already loged in then first log out their and then you can check by your
application . let me know if any issue come again .



there is no twitter application in my device & even in safari browser i am not logged in