因为这个我一整天都在用头撞墙。
我正在尝试解析这个JSON blob here。
这就是我正在使用的:
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSDictionary *results = [responseString JSONValue];
NSArray *allTweets = [[results objectForKey:@"response"] objectForKey:@"posts"];但是,当我尝试这样做时:
NSURL *url = [NSURL URLWithString:[[[[aTweet objectForKey:@"posts"] objectForKey:@"photos"] objectForKey:@"original_size"] objectForKey:@"url"]];它没有给我任何错误,但是*url被设置为"null“。
我对照片使用了CFShow,但“NSDictionary”键之后的所有内容都是一个常规字符串,而不是JSON格式。
有人能告诉我为什么吗?
提前感谢你的帮助。
发布于 2012-08-31 11:00:41
尝尝这个。
for (int i = 0; i < [[[results objectForKey:@"response"] objectForKey:@"posts"] count]; i++) {
NSLog(@"url data = %@",[[[[[[[results objectForKey:@"response"]
objectForKey:@"posts"] objectAtIndex:i] objectForKey:@"photos"]
objectAtIndex:0] objectForKey:@"original_size"] objectForKey:@"url"]);
}https://stackoverflow.com/questions/12207813
复制相似问题