Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

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 submit the url here.

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

Comments