我在我的iPhone应用程序中使用http://github.com/bengottlieb/Twitter-OAuth-iPhone/tree/master用于Twitter + Oauth.我正在尝试创建一个类似facebook连接的功能,可以登录并注销twitter.这个特殊的Twitter + Oauth实现不使用会话,所以我不确定这是如何工作的.
有没有人有这方面的经验,如果是这样,我将如何登出?
您必须在Cookie中清除Browser Bcz _engine商店用户名和密码的cookie.
这是Twitter中LogOut的正确代码.
-(IBAction) onLogOutClick:(id)sender { [_engine clearAccessToken]; [_engine clearsCookies]; [_engine setClearsCookies:YES]; [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"authData"]; [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"authName"]; NSLog(@"%@",[[NSUserDefaults standardUserDefaults]valueForKey:@"authName"]); NSLog(@"%@",[[NSUserDefaults standardUserDefaults]valueForKey:@"authData"]); [_engine release]; _engine=nil; 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]; } } }