微博iOS端SDK的使用方法,后来发现有个Bug,登出后,再次登入会跳过授权界面,直接进入发送微博界面,这样让用户想登出换个账号绑定应用发微博得不到实现,登出功能实际上没起作用,这里是解决方法:
找到导入src文件夹中的WBAuthorize.m文件,把startAuthorize函数的这里按下面代码这么改,字典添加@”true”,@”forcelogin”
- (void)startAuthorize
{
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:appKey, @"client_id",
@"code", @"response_type",
redirectURI, @"redirect_uri",
@"mobile", @"display", @"true",@"forcelogin", nil];
NSString *urlString = [WBRequest serializeURL:kWBAuthorizeURL
params:params
httpMethod:@"GET"];
WBAuthorizeWebView *webView = [[WBAuthorizeWebView alloc] init];
[webView setDelegate:self];
[webView loadRequestWithURL:[NSURL URLWithString:urlString]];
[webView show:YES];
[webView release];
}
然后就可以正确登陆了,另外还有一种清楚cookies的方法,没经过测试,记录于下:
NSHTTPCookie *cookie;
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];NSLog(@”cookies:%@”, [cookieJar cookies]);
for (cookie in [cookieJar cookies]) {
NSLog(@”cookies:%@”, cookie);
[cookieJar deleteCookie:cookie];
}NSLog(@”cookies1:%@”, [cookieJar cookies]);
@追风 2012/11/15