One of my UIViewController
has several child view controllers. They are built inside the interface builder, by dragging an NSObject
to the "Objects" section at left, then put in my own SpecialViewController
as "Custom Class". With this setup, upon viewDidLoad
I'll have my views and the controller ready. The workflow is suggested by the following screenshot:
And in my implementation, I have:
@interface ParentController : UIViewController
{
SpecialViewController *svc;
}
@property (nonatomic, retain) IBOutlet SpecialViewController *svc;
As I understand that during didReceiveMemoryWarning
I should release my own resources. Then set IBOutlets
to nil during viewDidUnload
.
I get crashes when simulating low memory in the simulator, with debugger pausing at didReceiveMemoryWarning
of SpecialViewController
(whose body is just [super didReceiveMemoryWarning];
), with error EXC_BAD_ACCESS (code=1, address=0xe0000008)
. At this time, the parent controller isn't visible, so it can be safely released.
Parent controller also contains only [super didReceiveMemoryWarning];
in didReceiveMemoryWarning
. I've tried niling IBOutlets
in both classes. It didn't help.
Any idea why this happened?
I'm targeting iOS 4 & 5 with ARC. SpecialViewController
is a subclass of UITableViewController
.
Through tracing, I found that ParentController didReceiveMemoryWarning
is called before SpecialViewController
.