我正在使用 Fabric SDK 登录 Twitter 帐户,当我登录时,在我的 viewDidLoad 方法中执行以下代码
- (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)tweetid)sender
{
[[Twitter sharedInstance] logOut];
}
但是这段代码对我不起作用,
请给我一个正确的方法
Best Answer-推荐答案 strong>
这是来自 Foundation 框架的 NSCookie 的问题,我在下面的代码的帮助下解决了这个问题
NSURL *url = [NSURL URLWithString"https://api.twitter.com"];
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:url];
for (NSHTTPCookie *cookie in cookies)
{
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
}
关于ios - 如何从我的 native ios 应用程序中注销 Twitter 帐户,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/30888471/
|