Reputation: 251
i am using a Fabric SDK for logine the Twitter account ,As i am logine Do the following code in my viewDidLoad method
- (void)viewDidLoad
{
[super viewDidLoad];
TWTRLogInButton *loginButton = [TWTRLogInButton buttonWithLogInCompletion:^(TWTRSession *session,NSError *error){
if (session) {
// mysession =session;
NSLog(@"signed in as %@", [session userName]);
} else {
NSLog(@"error: %@", error );
}
}];
loginButton.center = self.view.center;
[self.view addSubview:loginButton];
}
//and i use one UIButton for logOut ,And code for logout is as like
(IBAction)tweet:(id)sender
{
[[Twitter sharedInstance] logOut];
}
But this code is not working for me, please suggest me a right way
Upvotes: 2
Views: 215
Reputation: 251
this was a problem with NSCookie from Foundation framework And i slove this issues with help of below code
NSURL *url = [NSURL URLWithString:@"https://api.twitter.com"];
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:url];
for (NSHTTPCookie *cookie in cookies)
{
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
}
Upvotes: 1
Reputation: 286
You need to set TWTRSession nil for logout. so please check Logout Method.
Upvotes: 0