Snippet: Debug Macros

[EDIT: Revised to highlight the drama!]

Here’s a couple handy tips for your collection of Objective-C debugging macros which made it to the front page of iPhoneKicks where we noticed it, but it appears — see comments below! — were lifted wholesale from this post a month earlier, and the apparent real author is on a mission to set the Internet straight. Heh. That’s kinda amusing in a goths-on-LJ kind of way, isn’t it now? But seriously, this does look like a rather tacky case of blog plagiarism, so we’re happy to spotlight the controversy. Stay tuned for rebuttals!

That said, wherever credit is properly due, these are still worth appropriating for yourself:

Tip #1: PRETTY_FUNCTION will provide the Objective-C class name and method call.

Use like

and you get nicely readable output like this

Tip #2: Easy timer integration with NSTimeInterval.

Use like

and get a log message like

Also check out The Evolution of a Replacement for NSLog for another take on handy macro tricks!

h/t: iPhoneKicks!

Alex | April 17, 2009
  • Stephan Burlot April 18, 2009 at 5:24 am
    These macros have just been copied from my blog: http://blog.coriolis.ch/2009/01/05/macros-for-xcode/ and published one month before the one you mention.
  • Alex April 18, 2009 at 7:52 am
    Heh. Sure does look that way, doesn't it Stephan? That's rather tacky of that fellow, yes.

Leave a Reply