Code Snippet: Log Meaningful Information About (Nearly) Any Type In Objective-C

Being able to log information about data types at runtime can greatly aid in debugging and tweaking your apps.  With Objective-C you’ll typically doing this with the NSLog statement, unfortunately this can lead to crashes when trying to log non-Objective-C objects such as C strings.

I found out about a very useful macro that allows you to log meaningful information about nearly any type.   It is especially good for scalar expressions at runtime.   In fact the author even calls it the most useful code he’s ever written.

You can find the macro and more details on Vince Gable’s blog at:
The Most Useful Code I’ve Ever Written

This is a very hand macro to have.

Thanks for reading, please share this using the buttons below!

Learn how to quickly build apps using Phonegap and Dreamweaver from the start through a series of videos and example projects.  Over 7 hours of video so far explaining what you need to know including maps, the camera api, and more.
Read more...
DeliciousTwitterFacebookLinkedInEmail

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can send a Tweet to @maniacdev on Twitter or submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

One Response to Code Snippet: Log Meaningful Information About (Nearly) Any Type In Objective-C

  1. Pingback: [Blog Post] Code Snippet: Log Meaningful Information About (Nearly) Any Type In Objective-C - iPhone And iPad Development - Developer Forum

Click on a tab to select how you'd like to leave your comment

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>