我在解析目标 C 中的 JSON 字符串时遇到问题:我的 JSON:
{"messages":[{"nick":"Tim","message":"Hallo","time":"06.07.2012 13:26:41"}]}
我的目标 C 代码:
NSError *error = nil;
NSData *data = [NSData dataWithContentsOfURL:@"..URL.."];
NSArray *messages = [data objectForKey:@"messages"];
NSDictionary *json = [NSJSONSerialization
JSONObjectWithData:messages
options:NSJSONReadingMutableLeaves
error:&error];
NSString *nick = [json objectForKey:@"nick"];
NSString *message = [json objectForKey:@"message"];
但这不起作用,我不知道该怎么办!