0

我登录这些社交网站不是使用 safari,而是使用UIWebView应用程序内部。但是一旦登录,我就无法将它们注销。(尝试使用 fb SDK 和 ObjectiveFlickr,但他们的注销方法也无济于事。)

我尝试删除“login.yahoo.com”和“facebook.com”的 cookie,但没有帮助。我希望出现登录屏幕,但不是那样,而是直接要求身份验证。

4

1 回答 1

0

来自Facebook

//make access token nil here
//clear cache from webview
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies])
{
    NSString* domainName = [cookie domain];
    NSRange domainRange = [domainName rangeOfString:@"facebook"];
    if(domainRange.length > 0)
    {
        [storage deleteCookie:cookie];
    }
}

来自Flickr

//make access token nil here
//clear cache from webview
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies])
{
    NSString* domainName = [cookie domain];
    NSRange domainRange = [domainName rangeOfString:@"flickr"];
    if(domainRange.length > 0)
    {
        [storage deleteCookie:cookie];
    }
}
于 2014-02-18T10:03:47.900 回答