NSMutableArray の内容の NSLog を実行すると、以下が返されます。
(
hat,
hat
)
では、NSLog を次のように実行するNSLog(@"%@", [pro.matches objectAtIndex:0]);
と、エラーでクラッシュするのはなぜですか。*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
とても奇妙
これは私がそれを埋める場所です:
[self.matches removeAllObjects];
NSArray *JSONarray = [[NSArray alloc] initWithArray:[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil]];
int i;
for (i=0; i<[JSONarray count]; i++) {
//[self.matches addObject:[JSONarray objectAtIndex:i]];
[self.matches addObject:@"hat"];
}
//NSLog(@"boys with bo%@", [[matches objectAtIndex:1] objectForKey:@"host"]);
block();
//JSON and add to matches.
}
}];
block();
そして、これは私がそれを呼び出す場所です:
[pro refreshMatchesWithCallback:^
{
//[self.tableView reloadData];
NSLog(@"the count of a lifetime is %@", [pro.matches objectAtIndex:0]);
}];