How to get full exit from FHSTwitterEngine to Twitter Rest API v1.1?

FHSTwitterEngine *engine = [FHSTwitterEngine sharedEngine]; [engine clearAccessToken]; 

I tried the code, but when I try to log in again, the text fields do not appear in the presentModalViewController , it shows the "Authorization" application button.

There is another method [engine clearConsumer]; that shows Select and Copy the PIN in presentModalViewController

+8
ios objective-c iphone twitter
source share
2 answers

I believe that cookies still exist, which is the main problem with most twitter APIs on iOS.

Here's how you can check all cookies, put a check between them to clear only Twitter cookies, where you perform the twitter logout operation:

 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 this helps.

Hi,

Renault Jones

+12
source share

Add the method below to the FHSTwitterEngine.h and m files.

 - (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 the following method:

 [[FHSTwitterEngine sharedEngine] logout]; 
+4
source share

All Articles