title: UIViewController does not retain its programmatically-created UISearchDisplayController
body: <p>In the <code>UIViewController</code> <a href="https://developer.apple.com/documentation/uikit/uiviewcontroller/1621420-searchdisplaycontroller" rel="nofollow noreferrer">documentation</a> about the <code>searchDisplayController</code> property <a href="https://developer.apple.com/documentation/uikit/uiviewcontroller/1621420-searchdisplaycontroller" rel="nofollow noreferrer">1</a> it says:</p>
  
  <blockquote>
    <p>If you create your search display controller programmatically, this property is set automatically by the search display controller when it is initialized.</p>
  </blockquote>
  
  <p>And when I create my UISearchDisplayController thusly:</p>
  
  <pre><code>[[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self] autorelease];
  </code></pre>
  
  <p><code>-[UIViewController searchDisplayController]</code> is not <code>nil</code>.  However, it is nilled out after the event loop finishes, which causes the search display controller not to show when I touch inside the search bar.  Nothing crashes.  This is very weird.  If I omit the call to <code>autorelease</code>, everything works:</p>
  
  <pre><code>[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
  </code></pre>
  
  <p>However, leaks the <code>UISearchDisplayController</code> (I verified this with Instruments).  Since the <code>searchDisplayController</code> <a href="https://developer.apple.com/documentation/uikit/uiviewcontroller/1621420-searchdisplaycontroller" rel="nofollow noreferrer">property</a> is marked as <code>(nonatomic, retain, readonly)</code> I expect that it would retain the <code>UISearchDisplayController</code> after it is set.</p>
  
  <p><a href="https://stackoverflow.com/q/2395272/9636">This stackoverflow article</a> is related.</p>