我试图解析推特趋势,但我不断收到解析错误“as_of”。任何人都知道这是为什么发生?试图分析推特趋势
编辑:
下面是使用
NSMutableArray *tweets;
tweets = [[NSMutableArray alloc] init];
NSURL *url = [NSURL URLWithString:@"http://search.twitter.com/trends/current.json"];
trendsArray = [[NSMutableArray alloc] initWithArray:[CCJSONParser objectFromJSON:[NSString stringWithContentsOfURL:url encoding:4 error:nil]]];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
for (int i = 0; i < [trendsArray count]; i++) {
dict = [[NSMutableDictionary alloc] init];
//[post setObject: [[currentArray objectAtIndex:i] objectForKey:@"query"]];
[dict setObject:[trendsArray objectAtIndex:i] forKey:@"trends"];
//[dict setObject:[trendsArray objectAtIndex:i] forKey:@"query"];
//[post setObject:[trendsArray objectAtIndex:i] forKey:@"as_of"];
[tweets addObject:dict];
//post = nil;
}
您能发布一些示例代码和数据吗? – 2009-11-29 20:05:33
你刚刚使用http://search.twitter.com/trends/current.json?你使用的是什么JSON解析库/框架?发布您正在使用的代码。 – 2009-11-29 20:11:03
我使用CCJSON解析趋势 发表了上面的代码 – timothy5216 2009-12-01 03:20:32