简体   繁体   English

使用MGTwitterEngine注销?

[英]Logout using MGTwitterEngine?

如何在iPhone中以编程方式使用MGTwitterEngine API注销?

You mean how do you log out from the current account in MGTwitterEngine? 您的意思是如何从MGTwitterEngine中的当前帐户注销?

Well, that's easy, simply send the -endUserSession -selector to the engine like this: 好吧,这很简单,只需将-endUserSession -selector发送到引擎,如下所示:

MGTwitterEngine *engine = [MGTwitterEngine twitterEngineWithDelegate:self];
// Login...
// Do stuff...
[engine endUserSession]; // <-- Logs out

To Logout of the Twitter from MGTwitterEngine you need to call its methods with some change. 要从MGTwitterEngine注销Twitter,您需要进行一些更改来调用其方法。 In the MGTwitterEngine.m, search for _clearCookies . 在MGTwitterEngine.m中,搜索_clearCookies This is currently set to NO, change it to YES. 当前设置为“否”,将其更改为“是”。 In your action method for logging out the current user, call [ _engine clearAccessToken] . 在用于注销当前用户的操作方法中,调用[ _engine clearAccessToken]

Now run it, and voila, it works! 现在运行它,瞧,它起作用了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM