title: Is there a way to trap messages sent to nil in Objective-C?
body: <p>I've just been bitten by an annoying <a href="https://stackoverflow.com/questions/913627/uiviewcontroller-viewdidload-not-being-called">bug</a> that was made obscure by the "send message to nil is ok" behaviour in Objective-C.</p>
  
  <p>I've seen <a href="https://stackoverflow.com/questions/156395/sending-a-message-to-nil">Sending a message to nil?</a>, and the consensus seems to be 'thats how we roll' in Objective-C.</p>
  
  <p>Now, maybe I don't have enough experience in Objective-C, but it seems like it would be useful to trap this, because I can't think of a good reason why this should be happening <em>most</em> of the time. However, It could just be a coding idiom I'm not used to yet.</p>
  
  <p>So other than checking for nil everywhere like so:</p>
  
  <pre><code>assert( object != nil );
  [object message];
  </code></pre>
  
  <p>Is there a way to make the runtime trap this condition, and warn when <code>object</code> is nil?</p>