开发者

application crash in device

开发者 https://www.devze.com 2023-02-11 02:39 出处:网络
I have made one application. In this application i have load one tableView with some text and select row in tableview load another tableview but at the time ofselect row the application is crashed in

I have made one application. In this application i have load one tableView with some text and select row in tableview load another tableview but at the time of select row the application is crashed in device. this all are good working in simulator. But in device crashed. sample code at didselectedRowAtIndexPath

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 开发者_运维问答   
    NSLog(@"%d",indexPath.row);
    int k,i=0 ;
    for (k = 1; k<=indexPath.row; k=k++) {      
        i = k * [appDeleg.tableData count];         
    }

    NSMutableArray *tempArray = [[NSMutableArray alloc] init];
    appDeleg.finalDeptPayment = tempArray;
    [tempArray release];

    for (int j=0; j<[appDeleg.tableData count]; j++) {

        finalCalculationValue *objFinalValue = [[finalCalculationValue alloc] init];

        NSDecimalNumber *dec = [[NSDecimalNumber alloc] initWithDouble:[[appDeleg.ArrRowPayments2 objectAtIndex:i+j] doubleValue]];
        objFinalValue.DeptPayment = dec;

        NSLog(@"%@",dec);
        [appDeleg.finalDeptPayment addObject:objFinalValue];
    }       

    if (objDeptDetail == nil) {

        objDeptDetail = [[DeptAndPaymentdetail alloc] initWithNibName:@"DeptAndPaymentdetail" bundle:nil];

      [self.navigationController pushViewController:objDeptDetail animated:YES];

       [objDeptDetail release];
       objDeptDetail = nil;
    }       
}

so, pls tell me what I do?


Go to the Targets tab, look in the Executables group for your application, and double click on it. The window that comes up will be titled "Executable 'App Name' Info" and will have two tables in it, the top one is labeled "Arguments to be passed on launch:" the bottom one is labeled "Variables to be set in the environment:"

Click the add button for the bottom table give the new variable the name "NSZombieEnabled" and the value "YES." Then close the window and run your app (either in the simulator or the device.)

My guess is that now the app will exit with an exception in both environments and inform you which object is being used after it was deleted.

For more information: http://cocoa-nut.de/?p=16

0

精彩评论

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