以下代码不返回私人列表:
NSURL* url=[NSURL URLWithString:@"http://api.twitter.com/1/noppefoxwolf/lists.json"];
NSDictionary* params=[NSDictionary dictionaryWithObjectsAndKeys:nil];
TWRequest* timeline=[[TWRequest alloc] initWithURL:url parameters:params requestMethod:TWRequestMethodGET];
timeline.account=_account;
[timeline performRequestWithHandler:^(NSData* responseData,
NSHTTPURLResponse* urlResponse,NSError* error) {
NSError* jsonError=nil;
id data=[NSJSONSerialization JSONObjectWithData:responseData
options:0 error:&jsonError];
if (error!=nil) {
[self showAlert:@"" text:@"Error1"];
} else if (jsonError!=nil) {
[self showAlert:@"" text:@"Error2"];
} else {
NSArray * listsArray = [data objectForKey:@"lists"];
for (int i=0;i<listsArray.count;i++) {
NSDictionary* listDic=[listsArray objectAtIndex:i];
NSLog(@"NAME:%@\nMODE:%@",[listDic objectForKey:@"name"],[listDic objectForKey:@"mode"]);
}
}
}];
结果
NAME:list1
MODE:public
NAME:list2
MODE:public
↑ 不显示私人名单。