Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are releasing the <code>shareListController</code> controller. This is wrong, since both, that <code>dataSource</code>property as well as the <code>delegate</code> property of a table view are declared as having retention policy <code>assign</code>, which means, that they do <em>not</em> <code>retain</code> their values. This is the responsibility of client application/view controller.</p> <pre><code>@property(nonatomic, assign) id&lt;UITableViewDelegate&gt; delegate @property(nonatomic, assign) id&lt;UITableViewDataSource&gt; dataSource </code></pre> <p>See the <a href="http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006943-CH3-SW68" rel="nofollow noreferrer">UITableView Reference</a>. </p> <p>The best approach seems to be to declare an ivar in your view controller like: </p> <pre><code>@interface MyViewController: UIViewController { ... other stuff ... UITableView* shareListView; ShareListController* shareListController; } ... more stuff ... @end </code></pre> <p>In <code>MyViewController</code>'s <code>viewDidLoad</code> (or, wherever else you set up the table view) <code>alloc</code>/<code>init</code> the <code>shareListController</code> as usual, but instead of releasing the object after you have set up the <code>dataSource</code> and <code>delegate</code> properties, you remember the reference (you still own it) in the <code>shareListController</code> ivar.</p> <p>Finally, in the view controller's <code>dealloc</code> method, do:</p> <pre><code>- (void) dealloc { ... release other stuff ... shareListView.delegate = nil; // Really, really defensive shareListView.dataSource = nil; // here, but it won't hurt [shareListView release]; [shareListController release]; [super dealloc]; } </code></pre>
 

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