tableview reload in xcode 4.2
<p>I had worked on an application. In which I have programmatically added the table view. This app is working properly in any xcode lower than 4.2 but when I tried to run it on xcode 4.2 release version it is giving problem at table view reload. How to fix the error. please provide me some solution to resolve the error in xcode 4.2.</p>

<pre><code>-(void)viewDidAppear:(BOOL)animated{
    DebugLog(@"start");
    [self.tableView reloadData];

    execountarray=[[NSMutableArray alloc]init];
    for(int k=0;k&lt;[mSubUnitsArray count];k++)
    {
        SubUnit *subUnit = (SubUnit*)[mSubUnitsArray objectAtIndex:k];
        NSArray *subUnitExercises = [subUnit.subUnitExercise allObjects];
        [execountarray addObject:[NSString stringWithFormat:@"%d",[subUnitExercises count]]];
    }

    ///////////////
    if (managedObjectContext){

        NSFetchRequest *request = [[NSFetchRequest alloc] init];
        NSEntityDescription *entity = [NSEntityDescription entityForName:@"TSubUnitExerciseProgress" inManagedObjectContext:managedObjectContext];
        [request setEntity:entity];

        // Order the events by creation date, most recent first.
        NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"editDate" ascending:YES];
        NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
        [request setSortDescriptors:sortDescriptors];
        [sortDescriptor release];
        [sortDescriptors release];

        // Execute the fetch -- create a mutable copy of the result.
        NSError *error = nil;
        NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&amp;error] mutableCopy];
        if (mutableFetchResults == nil) {
            // Handle the error.
            myNotes = nil;
            [myNotes removeAllObjects]; 
        }
        else
        {
            [myNotes setArray: mutableFetchResults];
        }



        //NSLog(@"My notes count:--------unitviewcontroller---------------&gt;%d",[myNotes count]);
        if([myNotes count] ==0)
        {
        setExer1Done:NO;
        setExer2Done:NO;
        }
        else 
        {
            NSLog(@"hey :P");

        }

    }
    [self.tableView reloadData];  

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //DebugLog(@"-start- \n");

    CGFloat height = 0.0;

    SubUnit *subUnit = (SubUnit*)[mSubUnitsArray objectAtIndex:indexPath.row];
    NSArray *subUnitExercises = [self sortArray:[subUnit.subUnitExercise allObjects]];



    NSLog(@"mSelectedSubUnitIndex:%d",mSelectedSubUnitIndex.row);
    NSLog(@"subUnitExercises:%d",[subUnitExercises count]);


    if (indexPath.row==mSelectedSubUnitIndex.row &amp;&amp; [subUnitExercises count]&gt;1) {
        height =CELL_EXPAND_HEIGHT ;
    }
    else {
        height = CELL_NORMAL_HEIGHT;
    }


    return height;
}
</code></pre>

<p>It is giving crash at NSLog(@"mSelectedSubUnitIndex:%d",mSelectedSubUnitIndex.row); May be it is not loading the indexpath. Here mSelectedSubUnitIndex is the index path.
Thanku very much. </p>
