It's likely that your pinArray
variable isn't matching up to your call to objectAtIndex:
on your singleton array. Assuming [[Data singleton].annotations
holds the same type of information as your pinArray
variable, then you might try:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSNumber *num = [self.pinArray objectAtIndex:indexPath.row];
NSInteger index = [num integerValue]; //<-As an aside, observe I converted the number to integer type
...
...
}
The idea is that you are likely returning a higher row count than there are annotation objects in your array, hence the beyond bounds error.
Or else you should be doing this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSNumber *num = [[Data singleton].annotations objectAtIndex:indexPath.row];
NSInteger index = [num integerValue]; //<-As an aside, observe I converted the number to integer type
...
...
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [Data singleton].annotations.count;
}