如何在iphone应用程序中清除foursquare的cookie?

时间:2013-01-29 06:28:19

标签: iphone foursquare

我在我的应用程序中使用foursquare,但我不能在我的应用程序中从foursquare注销。

2 个答案:

答案 0 :(得分:1)

将以下代码用于应用

中的remove foursquare cookie
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies])
{
   NSString* domainName = [cookie domain];
   NSRange domainRange = [domainName rangeOfString:@"foursquare"];
   if(domainRange.length > 0)
   {
       [storage deleteCookie:cookie];
   }
}

答案 1 :(得分:0)

你需要在任何你想要的地方打电话

   NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie* cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {

    if ([cookie.name isEqualToString:@"FourSquare"]) {//its temprory name for your understanding
       [cookies deleteCookie:cookie];
    };

}