gpt4 book ai didi

ios - 我如何使用 iOS 中的结构框架从我的应用程序中注销 twitter

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:00:51 24 4
gpt4 key购买 nike

在我的 iOS 应用程序中,我使用 fabric 框架TWTRComposer”集成了 Twitter 登录。第一次登录并在 Twitter 上发布推文时,它工作正常。但我无法在我的应用程序中从 Twitter 注销。第二次当我尝试登录时。 twitterlogin View Controller 无法打开。所以请任何人都可以给我解决方案,以便使用 TWTRComposer

从我的应用程序中成功 登录和注销

最佳答案

[Twitter sharedInstance] 对象有两种注销方法:logOut 和 logOutGuest。

这是文档的链接:Twitter object iOS reference

仅供引用,您可以使用如下 session 参数检查用户是否已登录

[[Twitter sharedInstance] session ]

如果 session 为 nil 那么他们没有登录。

如果上面的方法不起作用,请尝试下面的方法,可能 cookie 仍然存在。

NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *each in cookieStorage.cookies) {
// put a check here to clear cookie url which starts with twitter and then delete it
[cookieStorage deleteCookie:each];
}

关于ios - 我如何使用 iOS 中的结构框架从我的应用程序中注销 twitter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30635425/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com