[indexPath row] uncaught exception
[indexPath row] uncaught exception
- Subject: [indexPath row] uncaught exception
- From: Koen van der Drift <email@hidden>
- Date: Mon, 25 Mar 2013 15:01:12 -0400
I am displaying an UITableView which can contain many rows (over 100).
Set up is straightforward, in viewDidLoad of the viewController I set up the datasource from the CoreData stack into an NSArray called myItems.
The delegate methods are also standard:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [myItems count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: @"MyCell"];
if (!cell)
{
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier: @"MyCell"];
}
Item *myItem = [self.myItems objectAtIndex: [indexPath row]];
[[cell textLabel] setText: myItem.name];
[[cell detailTextLabel] setText: myItem.title];
return cell;
}
Occasionally, the app crashes when scrolling/swiping to the last item in the tableview:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 104 beyond bounds [0 .. 103]'.
I understand what this means, but am puzzled how it can happen, since I am not modifying the datasource once the view is shown.
Am I overlooking something here?
Thanks,
- Koen.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden