Before/After call the block, the retaincount is always 1.
From apple block doc we know that the self should retain. Can anyone know why?
NSLog(@"Before block retain count: %d", [self retainCount]);
void (^block)(void) = ^(void){
UIImage* img = [UIImage imageNamed:@"hometown.png"];
[self setImage:img];
NSLog(@"After block retain count: %d", [self retainCount]);
};
block();
First, retainCount is useless. Don’t call it..
Blocks only retain captured objects when the block is copied. Thus,
selfwon’t be retained by the block in that example.