James Skidmore
James Skidmore

Reputation: 50278

iOS - EXC bad access, previously worked on iOS 4

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 */
...

Upvotes: 0

Views: 353

Answers (1)

albertamg
albertamg

Reputation: 28572

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]);

Upvotes: 4

Related Questions