开发者

UITableView crashes on iPhone when scroll down

开发者 https://www.devze.com 2023-04-13 01:34 出处:网络
I am developing a tableView which is crashing when I execute it in my iPhone and I don\'t know why is this happening. In the simulator works fine. However, in the iPhone, the scroll is not fluid and s

I am developing a tableView which is crashing when I execute it in my iPhone and I don't know why is this happening. In the simulator works fine. However, in the iPhone, the scroll is not fluid and smooth. When I scroll down just hiding the first row, it crashes and exits the app.

I found this lines in the Organizer console:

Sat Oct 15 23:22:54 unknown ReportCrash[33018] <Notice>: Formulating crash report for process MyApp[33017]
Sat Oct 15 23:22:55 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:WAY.MyApp[0xf392]) Job appears to have crashed: Bus error
Sat Oct 15 23:22:55 unknown SpringBoard[31481] <Warning>: Application 'MyApp' exited abnormally with signal 10: Bus error
Sat Oct 15 23:22:55 unknown ReportCrash[33018] <Error>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/MyApp_2011-10-15-232254_iPhone-de-Ibai.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0

Any idea? I've tried setting the rows to 0 and it works fine. Then tried with 1 row and it starts crashing again. I also tried to leave the row empty - doing "nothing" in tableView:cellForRowAtIndexPath - with no info to see if reading data was the problem.

If this log is not helping, could you tell me which methods are called when scroll down? I thought it was only tableview:cellForRowAtIndexPath:

Thank you!

EDIT:

The tableView:cellForRowAtIndexPath is:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"ContactsCell";

    ContactsCell *cell = (ContactsCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell==nil){
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ContactsCell" owner:self options:nil];
        for(id currentObject in topLevelObjects){
            if([currentObject isKindOfClass:[UITableViewCell class]]){
                cell = (ContactsCell *) currentObject;
                break;
            }
        }
    }

    // Configure the cell...
    Person *persona =[contactsArray objectAtIndex:indexPath.row];

    //Introducimos en la celda los datos.
    [cell setCellNames:[persona name]];
    [cell setCellStates:@"En Donosti"];
    UIImage *contactImage = [UIImage imageWithData:[persona pic]];
    if(contactImage != nil)开发者_StackOverflow
        [cell setCellPics:contactImage];

    return cell;
}

Doing some debug with NSLogs, the app stops working when calling the [table reload] (And I think that's the method which is calling when I scroll down).

0

精彩评论

暂无评论...
验证码 换一张
取 消