iOS应用程序冻结而不会崩溃

时间:2014-07-09 11:35:21

标签: ios objective-c memory-management memory-leaks

我的iOS应用程序在最初的几分钟内表现正常,但在使用10到15分钟后,动画(例如视图推送动画和UIAlertView动画)表现异常。他们似乎比平常更快地制作动画。之后,该应用程序冻结而不会崩溃。我必须强行杀死应用程序并重新启动才能再次使用它。

当我暂停调试器时,它会停止在线程#1(可能是UI线程)上,并显示以下汇编代码行:

error

注意:我已经检查了我的代码,并且在主UI线程上没有执行长时间运行的任务。

可能是什么原因?如何使用Instruments调试这些案例?

更新:实际上我已经缩小了一点。 我有一个由自定义单元组成的表视图。这些单元格每个都有2个按钮,这导致两种不同的形式,而didSelectRowAtIndexPath导致不同的视图。 当我继续从按钮上来回查看这些表格时,应用程序开始显示上述异常行为并最终冻结。

(在此期间来回,Instrument's Leaks显示出大量泄漏,但它们来自基础库。) 注意:它使用ARC

以下是代码段:

//Class interface
@interface tableViewController : UIViewController <TableViewCellDelegate , NetworkManagerDelegate> {
    IBOutlet UITextField *field1;
    NSMutableArray *tableData;

    UIAlertView *alertView;
    IBOutlet UIButton *backButton;
    NetworkManager *netMan;
    DetailsVC *detailsVC;
    AnotherDetailsVC *anotherDetailsVC;
}
....
..
@end


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"cellId";
    SecurityViewCell *cell = (TableCellView *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"TableCellView" owner:self options:nil] objectAtIndex:0];
    } else {
        NSLog(@"Cell reused");
    }
    obj1 = [tableData objectAtIndex:indexPath.row];
    cell.nameLabel.text = obj1.name;
    cell.delegate = self;
    cell.index = indexPath.row;

    cell.avatar.image = [UIImage imageNamed:@"IconTableRow"]; // for case of no photo on cell
    [netMan lazyLoadPhotoNamed:obj1.logo onImageView:cell.avatar];

    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    cell.backgroundColor = [UIColor clearColor];
    return cell;
}



// TableViewCell button press action
- (void) buttonPressed:(int)index {
    obj1 = [tableData objectAtIndex:index];

    if( obj1.isOfType1){
        detailsVC = [[DetailsVC alloc] init];
        detailsVC.delegate = self;
        [detailsVC setObjectOnForm:team1];
        [self.navigationController pushViewController:detailsVC animated:YES];
} else {
    ...
    ...
}

// Back button of DetailsVC
-(IBAction) backButtonPressed {
        [self.navigationController popViewControllerAnimated:YES];
}

0 个答案:

没有答案
相关问题