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!

©2010 iPhone, iOS 4, iPad SDK Development Tutorial and Programming Tips. All Rights Reserved.

.

Share and Enjoy:

RSS
Twitter
Facebook
DZone
HackerNews
del.icio.us
FriendFeed

Leave a Reply

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