在TWRequest中过滤转发

时间:2012-07-04 11:20:41

标签: objective-c ios twitter filtering twrequest

我正在使用TWRequest来查询twitter。我想知道如何在URL的末尾添加+ exclude:转推过滤器。 这是我的代码:

NSString *searchURL = [NSString stringWithFormat:@"http://search.twitter.com/search.json"];
        NSMutableDictionary *dict_req;

dict_req = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"50", @"rpp", @"true", @"include_entities", searchParams, @"q", nil];

TWRequest *request = [[TWRequest alloc] initWithURL:[NSURL URLWithString:searchURL]
                                                      parameters:dict_req requestMethod:TWRequestMethodGET];

[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
     {
      //results
    }];

1 个答案:

答案 0 :(得分:0)

第一个工作解决方案: 使用nil作为参数字典并手动将参数添加到searchURL。不幸的是,它似乎不适用于复杂的查询......

NSString * searchURL = [NSString stringWithFormat:@“http://search.twitter.com/search.json?q=ciao+exclude:retweets”];

TWRequest * request = [[TWRequest alloc] initWithURL:[NSURL URLWithString:searchURL]                                                           参数:nil requestMethod:TWRequestMethodGET];