FHSTwitterEngine *engine = [FHSTwitterEngine sharedEngine];
[engine clearAccessToken];
I tried above code but when I try to login again, textfields doesn't apear in presentModalViewController, it shows Authorize app button. 
There is another method,  [engine clearConsumer]; which results Select and Copy the PIN in presentModalViewController
I believe cookies still exists, that's the major issue with most of the twitter APIs on iOS.
This is how you can check for all cookies, put a check in between to clear only twitter cookies where you are performing a logout operation on twitter:
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (NSHTTPCookie *each in cookieStorage.cookies) {
       // put a check here to clear cookie url which starts with twitter and then delete it
         [cookieStorage deleteCookie:each];
    }
Hope it helps.
Regards,
Reno Jones
Add below method in FHSTwitterEngine.h and m file.
- (void)logout
{
  NSLog(@"Logged out from twitter");
  //These is FHSTwitterEngine class method which clears accesstoken
  [self clearAccessToken]; 
  //clear cache of twitter from NSHTTPCookieStorage
  NSHTTPCookie *cookie;
  NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
  for (cookie in [storage cookies])
  {
    NSString* domainName = [cookie domain];
    NSRange domainRange = [domainName rangeOfString:@"twitter"];
    if(domainRange.length > 0)
    {
        [storage deleteCookie:cookie];
    }
  }
}
EDIT : Use these method like these :
[[FHSTwitterEngine sharedEngine] logout];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With