我想解析下面给出的所有数据和数组然后在iPhone应用程序中使用来显示。
http://www.krsconnect.no/community/api.html?method=fullEvents&appid=620
SBJsonParser *parser = [[SBJsonParser alloc] init];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.krsconnect.no/community/api.html?method=fullEvents&appid=620"]];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
NSDictionary *object = [parser objectWithString:json_string error:nil];
NSArray *results = [parser objectWithString:json_string error:nil];
NSDictionary *dictOne = [results objectAtIndex:0];
NSArray *activitiesArray = [dictOne objectForKey:@"activities"];
NSDictionary *dictTwo = [activitiesArray objectAtIndex:0];
NSDictionary *eventDict = [dictTwo objectForKey:@"event"];
NSDictionary *dictThree = [activitiesArray objectAtIndex:0];
NSDictionary *eventDict3 = [dictThree objectForKey:@"images"];
NSLog(@"%@ - %@", [eventDict3 objectForKey:@"large"]);
NSLog(@"%@ - %@", [eventDict objectForKey:@"category"]);
NSLog(@"%@ - %@", [eventDict objectForKey:@"content"]);
答案 0 :(得分:0)
它工作正常,但如果我从日期对象打印HoursFrom它不打印
这是因为在您的数据Feed中, hoursFrom ,而不是HoursFrom。案件很重要。