开发者

why would this code crash with "attempt to access previously deallocated instance"?

开发者 https://www.devze.com 2023-04-11 22:04 出处:网络
Aren\'t i doing this the standard way?I see this format quite a bit and am not sure why my code eventually crashes and tells me I\'m trying to access a previously deallocated instance.

Aren't i doing this the standard way? I see this format quite a bit and am not sure why my code eventually crashes and tells me I'm trying to access a previously deallocated instance.

Any help appreciated.

开发者_Go百科
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {

    vcListGrades *listGradesViewController = [[vcListGrades alloc] initWithNibName:@"vcListGrades" bundle:nil];

    listGradesViewController.managedObjectContext = self.managedObjectContext;
    Course *sCourse = [_fetchedResultsController objectAtIndexPath:indexPath];
    [listGradesViewController setCourse: sCourse];

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

    [listGradesViewController release];

}


Are you sure the problem is with your view controller, I would much likely say the problem is with sCourse, be sure of the memory management you do of the property course in your vcListGrades class. The management of the UIViewController seems to be just fine.

0

精彩评论

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