Open Source Objective-C Category That Makes Block Related Logging Statements More Meaningful

I’ve mentioned a number of useful open source projects for more meaningful logs such as this excellent Xcode plugin for colorizing debug console text.

Here’s a handy NSBlock category from Conrad Kramer called BlockTypeDescription that makes log statements related to a block considerably more descriptive.

An example from the readme:

NSString * (^someBlock)(NSString *, BOOL, CGRect, float*[30]) = ^(NSString *a, BOOL b, CGRect c, float *d[30]) {
    return @"Some return value";
};
NSLog(@"This is my block! %@", someBlock);

This produces the following result with BlockTypeDescription:

This is my block! < __nsglobalblock__: (id (^)(id, char, struct CGRect, float*[30]))>

rather than the default:

This is my block! < __nsglobalblock__: 0x35c0>

You can find BlockTypeDescription on Github here.

A very useful add-on for working with blocks.

DeliciousTwitterFacebookRedditLinkedInEmail

Original article: Open Source Objective-C Category That Makes Block Related Logging Statements More Meaningful

©2013 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

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