Pro Tip: Data Types Matter — 5 Comments

  1. Here’s a pro tip from me:

    If you start writing a predefined method header like in your example, omit the type. I.e., just type:


    That’ll be detected by Xcode’s code completion assistant, and if you then choose your function from the menu, it’ll add the right return type for you as well.

  2. that’s interesting! I usually disable the autocomplete. Doesn’t it gets caught by the Analyzer? I would try it when I get back to my machine.

  3. It would be great for Xcode or the ObjC runtime to catch errors like this. One approach we use is in our frameworks,

    With this in place, you get a runtime warning like:

    2012-11-29 08:41:54.267 OmniOutliner-iPad[50968:c07] Method tableView:numberOfRowsInSection: has conflicting type signatures between class and its adopted protocol:
    signature f16@0:4@8i12 for class ColumnFormatterInspectorPane has imp -[ColumnFormatterInspectorPane tableView:numberOfRowsInSection:] at 0x81ee0 in OmniOutliner-iPad
    signature i16@0:4@8i12 for protocol UITableViewDataSource

    Comically, we had to add a mode to squelch warnings from within the system frameworks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

%d bloggers like this: