[英]logout from Twitter in iPhone using OAuth+MGTwitterEngine Library
I had made the twitter application using the OAuth and MGTwitterEngine Library. 我使用OAuth和MGTwitterEngine库制作了Twitter应用程序。 The login phase is working fine but I am facing problem in logout. 登录阶段工作正常,但我在登出时遇到问题。 I had referred all the post of logout for OAuth but it doesn't works. 我已经提到了注销OAuth的所有帖子,但它不起作用。 So can anyone suggest the perfect method for logout from the Twitter ...? 所以有人可以建议从Twitter注销的完美方法......? OR What changes I have to make in the Library file for the logout..!! 或者我要在库文件中进行哪些更改以进行注销.. !!
Did anyone ever find the solution for this? 有没有人找到解决方案? If so, please post! 如果是的话,请发帖!
UPDATE: I figured it out. 更新:我明白了。 In the MGTwitterEngine.m, search for _clearCookies in initWithDelegate method. 在MGTwitterEngine.m中,在initWithDelegate方法中搜索_clearCookies。 This is currently set to NO, change it to YES. 这当前设置为NO,将其更改为YES。 In your action method for logging out the current user, call [_engine clearAccessToken]. 在用于注销当前用户的操作方法中,调用[_engine clearAccessToken]。 Now run it, and voila, it works! 现在运行它,瞧,它的工作原理!
There is no sign out from Twitter OAuth/xAuth... you need to implement client side solution: Twitter OAuth / xAuth没有退出...你需要实现客户端解决方案:
hope that will help 希望这会有所帮助
I use this tutorial for integreate twitter to iOS app link 我使用本教程来集成twitter到iOS应用程序链接
For logout I use next: 对于注销,我使用下一个:
[_engine clearAccessToken];
_engine - this is instance of SA_OAuthTwitterEngine class. _engine - 这是SA_OAuthTwitterEngine类的实例。
You can call this method on your IBAction method. 您可以在IBAction方法上调用此方法。
Also need this method 还需要这种方法
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults removeObjectForKey:@"authData"];
[defaults synchronize];
I dont know how to logout. 我不知道如何退出。 But if you want the login screen every time, do one thing (i dont know this is the right way), delete the login specific data which the engine saves in Userdefaults. 但是如果你想每次都登录屏幕,做一件事(我不知道这是正确的方法),删除引擎在Userdefaults中保存的登录特定数据。
我没有在这里明确说明,但是我在SA_OAuthTwitterEngine中使用了“clearAccessToken”函数来“注销”当前用户。
Might be kinds of stupid, but this seems to work 可能是各种愚蠢的,但这似乎有效
- (IBAction)logout:(id)sender {
[_engine dealloc];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults removeObjectForKey:@"authData"];
[defaults synchronize];
[self presentLoginView];
}
您必须在iPhone应用程序中删除您的帐户,该应用程序位于iPhone的“设置”菜单中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.