清除新微博Cookie

在WBEngine.m文件里将如下方法里添加黑体部分代码,可清除Cookie,使登录后用islogin得到的标志位为更新后的标志位。

- (void)deleteAuthorizeDataInKeychain

{

    self.userID = nil;

    self.accessToken = nil;

    self.expireTime = 0;

    

    NSHTTPCookie *cookie;

    NSHTTPCookieStorage *storage = [NSHTTPCookieStoragesharedHTTPCookieStorage];

    for (cookie in [storage cookies]) {

        [storage deleteCookie:cookie];

    }//清除cookie

    

    NSString *serviceName = [[self urlSchemeString] stringByAppendingString:kWBKeychainServiceNameSuffix];

    [SFHFKeychainUtilsdeleteItemForUsername:kWBKeychainUserIDandServiceName:serviceName error:nil];

[SFHFKeychainUtilsdeleteItemForUsername:kWBKeychainAccessTokenandServiceName:serviceName error:nil];

[SFHFKeychainUtilsdeleteItemForUsername:kWBKeychainExpireTimeandServiceName:serviceName error:nil];

}

posted @ 2012-06-20 09:59  宸垣  阅读(506)  评论(0编辑  收藏  举报