Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 11th, 2012  |  syntax: Objective C  |  size: 0.46 KB  |  views: 53  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #import <Foundation/Foundation.h>
  2.  
  3. int main (int argc, char * argv[])
  4. {
  5.     NSObject *captureObject = [NSObject new];
  6.  
  7.     NSLog(@"Before block: %lu", [captureObject retainCount]);
  8.    
  9.     void (^block)() = ^{
  10.         NSLog(@"Inside block: %lu", [captureObject retainCount]);
  11.     };
  12.    
  13.     NSLog(@"After block creation: %lu", [captureObject retainCount]);
  14.    
  15.     block();
  16.    
  17.     NSLog(@"After block call: %lu", [captureObject retainCount]);
  18. }