因未捕获的异常'NSGenericException'而终止应用程序,原因:'*** Collection <calayerarray:0x66522e0 =“”>在枚举时发生了变异</calayerarray:>

时间:2012-11-27 04:38:58

标签: iphone ios ios4

有些时候,我的应用程序因显示 * 而崩溃,而且在枚举时突变了。这一直发生在同一行代码中。请帮我解决这个问题。我坚持这个。应用程序在推送我的代码的视图控制器行时崩溃。但它不常见。我的错误控制台

由于未捕获的异常'NSGenericException'而终止应用程序,原因:' * 集合CALayerArray:0x1030c730在枚举时发生了变异。     “”     “”     “”     “”     “”     “”     “”     “”     “”     “”     “”     “”     “”     “”     “”     “”     “”     “” )'

我的代码:

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
 ServiceDetails *service=[[ServiceDetails  alloc] initWithNibName:@"ServiceDetails"   bundle:nil];  
    CompanyListingForm *list=[[CompanyListingForm  alloc]initWithNibName:@"CompanyListingForm" bundle:nil];
[category_company_text resignFirstResponder];
if(viewHoldingTable)
{
    [viewHoldingTable removeFromSuperview];
}
if (category_clicked_flag==0) {
    if (location_or_cat_com==0) {
        NSMutableArray *get=[district_array objectAtIndex:indexPath.row];
        locationid=[[get objectAtIndex:0]intValue];
        [location_textfield resignFirstResponder];
        location_textfield.text=[get objectAtIndex:1];
    }
    else
    {
        if (draggingView) {
            [draggingView removeFromSuperview];

        }
        if (viewHoldingTable) {
            [viewHoldingTable removeFromSuperview];
        }


        NSMutableArray *get=[company_array objectAtIndex:indexPath.row];
        category_company_text.text=[get objectAtIndex:1];



        service.ida=[NSString stringWithFormat:@"%d",[[get objectAtIndex:0] intValue]];

        service.idloc=[NSString stringWithFormat:@"%d",locationid];



        [self.navigationController pushViewController:service animated:YES];//getting error at this point.

        //[emer release];   
    }
}
else
{
    if (location_or_cat_com==0) {
        NSMutableArray *get=[district_array objectAtIndex:indexPath.row];
        locationid=[[get objectAtIndex:0]intValue];
        [location_textfield resignFirstResponder];
        location_textfield.text=[get objectAtIndex:1];
    }
    else
    {
        NSMutableArray *get=[category_array objectAtIndex:indexPath.row];
        category_company_text.text=[get objectAtIndex:1];
        int catid=[[get objectAtIndex:0]intValue];

        list.IDForLoc=[NSString stringWithFormat:@"%d",locationid];
        list.IDForCat=[NSString stringWithFormat:@"%d",catid];
        list.companydetails=[get objectAtIndex:1];
        [self.navigationController pushViewController:list animated:YES];//getting error at this point.

    } 
}
 [service release];
 [list release];
}

1 个答案:

答案 0 :(得分:0)

我认为问题在于,当您要求推送视图控制器时,您正在对界面执行所有这些操作。尝试将pushViewController行包裹在dispatch_after块中,延迟时间为.1秒,以便对接口时间进行其他更改以便安定下来。或者以另一种方式执行:将removeFromSuperview内容放入延迟中。更好的是,抛出某种标志,以便稍后在viewWillAppear上删除要从superview中删除的内容。你现在不需要这样做;无论如何,你都要用推动的视图控制器来隐藏这个视图。

相关问题