When I do an NSLog of the contents of my NSMutableArray, it returns :
(
hat,
hat
)
So why is it that when I do an NSLog like so NSLog(@"%@", [pro.matches objectAtIndex:0]);
it crashes with the error: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
So strange
This is where I fill it:
[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();
and this is where i call it:
[pro refreshMatchesWithCallback:^
{
//[self.tableView reloadData];
NSLog(@"the count of a lifetime is %@", [pro.matches objectAtIndex:0]);
}];