I need to work on getting better with the debugger in xcode.
Thought this was worth sharing just because the behavior was NOT what I expected.
This will work:
[code]- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection: (NSInteger) section {
int numberOfRows = [possessions count];
if ([self isEditing]) {
numberOfRows++;
}
return numberOfRows;
}[/code]
This will blow up and cause a stack trace:
[code]- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection: (NSInteger) section {
int numberOfRows = [possessions count];
if ([self isEditing]) {
return numberOfRows++;
}
return numberOfRows;
}[/code]
Didn’t step it threw the debugger but off the top of my head it MUST be doing a return of the value before adding one to it.
Happy coding!
Ed