iPhone应用程序崩溃 - 错误消息发送到解除分配的实例0xa58a950

时间:2013-10-03 06:40:24

标签: iphone ios ipad crash memory-management

在我的iPhone应用程序中,我已实现了侧边栏,即JTRevealSideBar,以显示左侧的侧栏,如facebook app 但是,问题是它在点击第一个索引的侧边栏tableview后崩溃了,但是对于其他索引它完全正常工作

崩溃日志      [sidebarViewController:didSelectObject:atIndexPath:]:发送到解除分配的实例0xa58a950的消息

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.sidebarDelegate) 
        {
        SALSideBarViewCell * cell = (SALSideBarViewCell*)[tableView cellForRowAtIndexPath:indexPath];
        NSObject *object = cell.titleLabel.text;

        [self.sidebarDelegate sidebarViewController:self didSelectObject:object atIndexPath:indexPath];
    }
}

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

SALSideBarViewCell * salcell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (salcell == nil) {
    salcell = [[[SALSideBarViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    tableView.separatorColor = [UIColor clearColor];
    if ([UIHelper isPad]) {
        UIView *cellBackView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 60)] autorelease];
        cellBackView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"sidebar_cell_pad.png"]];
        salcell.backgroundView = cellBackView;
    } else {
        UIView *cellBackView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 40)] autorelease];
        cellBackView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"sidebar_cell.png"]];
        salcell.backgroundView = cellBackView;
    }
}

if ( indexPath.section == 0 ) {
    cellText = [dataArray objectAtIndex:indexPath.row];
    if ( indexPath.row == 0 && self.slideDecksCount > 0 )
        [salcell setValue:[NSString stringWithFormat:@"%d", self.slideDecksCount]];
    else if ( indexPath.row == 1 && [[[RDStore sharedInstance] publicUsers] count] > 0 )
        [salcell setValue:[NSString stringWithFormat:@"%d", [[[*** sharedInstance] ***] count]]];
    else if ( indexPath.row == 2 && [[[RDStore sharedInstance] premiumUsers] count] > 0 )
        [salcell setValue:[NSString stringWithFormat:@"%d", [[[*** sharedInstance] ***] count]]];
    else if ( indexPath.row == 3 && [[[RDStore sharedInstance] tagCloudlabels] count] > 0 )
        [salcell setValue:[NSString stringWithFormat:@"%d", [[[*** sharedInstance] ***] count]]];
    else if ( [dataArray count] > 4 && indexPath.row == 4 && self.jsonDecksCount > 0 )
        [salcell setValue:[NSString stringWithFormat:@"%d", self.jsonDecksCount]];
}
else {
    cellText = [services objectAtIndex:indexPath.row];
}
salcell.titleLabel.text = cellText;
return salcell;

}

请告诉我错误的地方 感谢

0 个答案:

没有答案