NSString *url = [NSString stringWithFormat:@"http://api.twitter.com/1.1/search/tweets.json?q=%@&result_type=recent&count=%i", toBeSearched, count];
url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
SLRequest *twitterInfoRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:url] parameters:nil];
[twitterInfoRequest setAccount:twitterAccount];
[twitterInfoRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if ([urlResponse statusCode] == 429) {
//Rate Limit Reached
} else if (error) {
// Check if there was an error
}
// Check if there is some response data
if (responseData) {
NSError *error = nil;
NSArray *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
// Do Whatever you want to do, the result is an array of 'tweet objects'
}
}];
啊,我想我只是得到某种URL作为回应,但它看起来像你根据我的历史猜测了Objective-C? 虽然我从代码中收集URL,但我正在尝试使用它。所以你说的东西像'http://api.twitter.com/1.1/search/tweets.json?q = ABC&result_type = recent&count = 10' – muttley91
你可以通过URL传递更多参数:https:/ /dev.twitter.com/docs/api/1/get/search –
哦。我以为你问它的iOS。那么,该网址就是您在代码中找到的网址。 –