【问题标题】:How to get private list in twitter with iOS5?如何使用 iOS5 在 Twitter 中获取私人列表?
【发布时间】:2012-08-10 17:30:07
【问题描述】:

以下代码不返回私人列表:

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

↑ 不显示私人名单。

【问题讨论】:

    标签: objective-c list ios5 twitter private


    【解决方案1】:

    来自documentation

    如果经过身份验证的用户相同,则将包含私人列表 作为正在返回列表的用户。

    您没有传入任何参数,因此没有指定 user_id 值(即使文档说它是必需的!)。我猜noppefoxwolf 不是您的认证用户。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-26
      • 1970-01-01
      • 2014-01-19
      • 2013-06-22
      • 2021-09-14
      • 1970-01-01
      相关资源
      最近更新 更多