Tôi đẩy một bộ điều khiển xem vào stack điều khiển chuyển hướng của tôi từ bên trong phương pháp didSelectRowAtIndexPath TableViewController của tôi như vậy:Tại sao điều này lại được phát hành? UINavigationController/UITableView
MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
MyObject *myO = (MyObject *)[appDelegate.myOs objectAtIndex:indexPath.row];
myViewController.amount = myO.amount;
[self.navigationController pushViewController:myViewController animated:YES];
[myViewController release];
Nếu tôi bỏ ghi chú rằng dòng cuối cùng thì treo ứng dụng khi trở về với một lỗi:
-[CALayer release]: message sent to deallocated instance 0xd4f860
Đào sâu hơn một chút, tôi thấy tai nạn có thể bị thu hẹp lại thành lệnh gọi [super dealoc] trong phương thức dealoc của MyViewController. Bằng cách uncommenting "[super dealoc]", chúng tôi không sụp đổ.
Tôi đang gặp sự cố khi thu hẹp hơn nữa. "siêu" sẽ là lớp UIViewController và tôi không thể điều tra thêm rằng phương pháp dealoc ... tôi có thể? Có lẽ có một cách để xem chính xác những gì 0xd4f860 chỉ đến nhưng tôi không biết làm thế nào? Bất kỳ ý tưởng?
Bạn có đang phát hành myViewController.view ở bất kỳ đâu không? –