我想获得Twitter目前的趋势。我累了https://dev.twitter.com/docs/api/get-trendscurrent
,但没有数据没来。我的代码在这里:
-(void) getTwitterTopTrends{
// 1. Create a variable for twitter
NSURL *feedURL = [NSURL URLWithString:@"http://api.twitter.com/1/trends/current.json"];
// 2. Create TWRequest, with parameters, URL & specify GET method
SLRequest *twitterFeed = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:feedURL parameters:nil];
twitterFeed.account = _twitterAccount;
// Making the request
[twitterFeed performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
// Check if we reached the reate limit
if (responseData) {
NSError *error = nil;
NSDictionary *TWData = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
NSArray* results = TWData [@"trends"];
}
});
}];
}
我错了。