You should not call objectAtIndex:without knowing if the array contains an object by index. Instead, you should check
if (indexPath.row < [array count])
And if you use arrayas a data source for tableView. You should just return the [array count]number of rows,
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [array count];
}
indexPath.row - .
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSObject *obj = [array objectAtIndex:indexPath.row];
}