SHARE
TWEET

Untitled

a guest Sep 11th, 2012 66 Never
  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. }
RAW Paste Data
Top