Note that there are some explanatory texts on larger screens.

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

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload