title: How to get Xcode to generate warning (or error) on Mismatched Return Type?
body: <p>I just made a code change in the type for a method's return type and was counting on the compiler to show warnings which would allow me to find and fix wherever the mismatch now occurs.  But no warnings.  In my Settings I discovered that "Mismatched Return Type" was already "Yes" for all build types, so I decided to change it to "Yes (treat as error)" and did a rebuild.  Still no indication in build results.</p>
  
  <p>I then changed "Treat Warnings as Errors" to "Yes" and that produced a few helpful error messages, but no mismatch warnings. Perhaps I do not understand something about the compiler and Objective-C return types, but it seems that a bool should not be acceptable when my method specifies that is should return an NSNumber*.  </p>
  
  <p>Here is my code:</p>
  
  <pre><code>+(NSNumber*) compilerCompletelyFineWithThis
  {
      if ([m_session tryThis])
      {
          return [m_session goGetSumthin];
      }
      else
          return false;
  }
  </code></pre>
  
  <p>The docs suggest that Mismatched Return Type is associated with GCC_WARN_ABOUT_RETURN_TYPE, but it is not clear what rules this enforces.</p>
  
  <p>In the pic below of the warnings section(s) of my Build Settings, notice the relevant settings. I have "Treat Warnings as Errors" and "Mismatched Return Type" turned on for all my builds.</p>
  
  <p><a href="https://i.stack.imgur.com/DylbY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DylbY.png" alt="enter image description here"></a></p>
  
  <p>Is there a way to get Xcode to let me know when I am violating this kind of contract between a method definition and the calling code?</p>