上記のコメントが信じられないほど混乱していることに気付きました。うまくいけば、次のことで私が言おうとしていたことが明確になります。
- (void)yourMethod:(Foo *)parameterFoo
{
__block Foo *blockVariable = [Foo someFoo];
Foo *capturedVariable = [Foo anotherFoo];
void(^doWorkBlock)(Foo *bp) = ^(Foo *bp){
// If your block accesses a scoped variable that is not marked with __block, it will
// retain it, so here capturedVariable and bp would be retained by the block
capturedVariable.aProperty = 5.0;
bp.aProperty = 10.0;
// As you can see, you can modify the objects all you like.
// What you cannot do is assign something to capturedVariable or bp because they
// were not marked as __block
// WONT WORK
capturedVariable = [Foo new];
// However, you can write to blockVariable because it is marked as __block
// WORKS
blockVariable = [Foo new];
// Remember, though that the block will not retain this variable itself because
// of the __block
};
// Note, it's weird for the block to take a parameter since it could just access the
// variable directly. This just serves to show how a block would handle a parameter.
doWorkBlock(parameterFoo);
}