0
votes

Unless I'm out of my mind, this was working properly on iOS4. I updated to iOS5, and now it's throwing this bad access error on [indexPath section]. It's on a UITableView:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{    
    // Get the cell label and value
    NSLog(@"section: %@", [indexPath section]); /* BAD ACCESS ERROR HERE */
...
1
Just to note, for your reassurance, that I have had a number of things (quite different to this) that worked fine in iOS4 that were causing issues or outright crashes in iOS 5... so your experience is not unique.Duncan Babbage

1 Answers

4
votes

The log statement itself is causing the error.

NSLog(@"section: %@", [indexPath section]); /* BAD ACCESS ERROR HERE */

You are trying to log an integer as if it was an object. It should be:

NSLog(@"section: %i", [indexPath section]);