データを取得していますが、「予約可能」=1であることが検出されるたびにデータがNSLogに投稿されているようです。これは1回だけ投稿する必要があると思いますが、テーブルビューセルに表示すると、複数回投稿されますか?これが私のNSLogです:
2012-08-31 11:35:39.682 GBSB[2168:15b03] These are the times avail: (
)
2012-08-31 11:35:39.683 GBSB[2168:15b03] These are the times avail: (
"2012-08-31 08:00:00 America/Los_Angeles"
)
2012-08-31 11:35:39.683 GBSB[2168:15b03] These are the times avail: (
"2012-08-31 08:00:00 America/Los_Angeles",
"2012-08-31 08:15:00 America/Los_Angeles"
)
2012-08-31 11:35:39.683 GBSB[2168:15b03] These are the times avail: (
"2012-08-31 08:00:00 America/Los_Angeles",
"2012-08-31 08:15:00 America/Los_Angeles",
"2012-08-31 08:30:00 America/Los_Angeles"
)
2012-08-31 11:35:39.684 GBSB[2168:15b03] These are the times avail: (
"2012-08-31 08:00:00 America/Los_Angeles",
"2012-08-31 08:15:00 America/Los_Angeles",
"2012-08-31 08:30:00 America/Los_Angeles",
"2012-08-31 08:45:00 America/Los_Angeles"
)
2012-08-31 11:35:39.684 GBSB[2168:15b03] These are the times avail: (
"2012-08-31 08:00:00 America/Los_Angeles",
"2012-08-31 08:15:00 America/Los_Angeles",
"2012-08-31 08:30:00 America/Los_Angeles",
"2012-08-31 08:45:00 America/Los_Angeles",
"2012-08-31 09:00:00 America/Los_Angeles"
)
2012-08-31 11:35:39.684 GBSB[2168:15b03] These are the times avail: (
"2012-08-31 08:00:00 America/Los_Angeles",
"2012-08-31 08:15:00 America/Los_Angeles",
"2012-08-31 08:30:00 America/Los_Angeles",
"2012-08-31 08:45:00 America/Los_Angeles",
"2012-08-31 09:00:00 America/Los_Angeles",
"2012-08-31 09:15:00 America/Los_Angeles"
)
これが私が使用している私のコードです。
- (void)fetchedData:(NSData *)responseData {
//parse out the json data
NSError* error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
NSDictionary* myslots =[json objectForKey:@"slots"];
for (NSString *slotKey in myslots.allKeys) {
NSDictionary *slot = [myslots valueForKey:slotKey];
NSArray *tests = [myslots objectForKey:slotKey];
NSMutableArray *timesArray = [[NSMutableArray alloc] init];
for (NSDictionary *myDays in tests){
if ([[myDays objectForKey:@"isReservable"] isEqualToNumber:[NSNumber numberWithInt:1]])
[timesArray addObject:[myDays objectForKey:@"begin"]];
NSLog(@"These are the times avail: %@", timesArray);
}
}