for(NSUInteger j = 0 ; j < [sports count] ; j++){
NSIndexPath *loopPath = [NSIndexPath indexPathWithIndex:j];
if([pickerTable cellForRowAtIndexPath:loopPath].accessoryType == UITableViewCellAccessoryCheckmark){
[chosenSports addObject:[pickerTable cellForRowAtIndexPath:loopPath].textLabel.text];
}
}
This code produces a sigabrt error. The exact error is “Invalid index path for use with UITableView. Index paths passed to table view must contain exactly two indices specifying the section and row. Please use the category on NSIndexPath in UITableView.h if possible.” Thanks in advance;
The error is correct. NSIndexPaths consist of a row and a section number, which is especially true for table views considering how blind to your implementation they actually are (considering they rely on a datasource and a delegate). You have a simple initializer error, try this instead: