1

At a certain point in my app within a tableView:cellForRowAtIndexPath: method, I call [tableView dequeueReusableCellWithIdentifier:identifier], and I get a fully-reproducable EXC_BAD_ACCESS crash on iOS 7.0.x devices, but never on iOS 7.1.x devices. I have numerous table views throughout the app, and I can call the dequeue method successfully elsewhere throughout the app.

I'm being intentionally vague because I'm not asking for a solution to the crash itself; I'm trying to get information on what specifically changed between 7.0 and 7.1 that would be causing any different behavior at all concerning UITableViewCells and the dequeue method. I have checked Apple's own 7.0 to 7.1 diffs document, but it claims there were no changes at all to UIKit. I'm also well-aware that Apple is famous for not telling "the whole story" in their developer documentation.

Code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        NSString static *identifier = @"MyTableViewCell";

        // crashes on the following line
        SMTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];

        if (cell == nil) {
            cell = [[SMTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        }

        // ...

    } else {

        // ...

    }
}
n00neimp0rtant
  • 905
  • 1
  • 8
  • 18
  • 1
    Try to enable zombies to see more information about crash: http://stackoverflow.com/a/20109137/979990 – Carlos Jiménez May 08 '14 at 20:29
  • That was one of the first things I tried; while I've had success with zombies before, it just dropped me off at the same exception breakpoint with no useful additional info. – n00neimp0rtant May 09 '14 at 00:45
  • 1
    Give your code in cellForRow method? – nmh May 09 '14 at 02:00
  • @nmh I've updated the post with as much of the code as I can possibly give without losing my job. – n00neimp0rtant May 09 '14 at 15:56
  • Enable zombies and post the result. But you should not be allocating cells yourself. Read about the `register` methods available since iOS5 that allow you to register a cell class or a nib, and `dequeueReusableCellWithIdentifier:` is guaranteed to return a value. – Léo Natan May 09 '14 at 16:11

0 Answers0