From my understanding when an object method receives a block as a completion argument I can send "self" in the block:
[object doMethodWithCompletion:^{
[self doSomethingWhenThisMethodCompletes]
}];
but if this object "retains" the block (saves it for future use) I should send a "weak" copy of myself:
__weak __typeof__(self) weakSelf = self;
object.savedBlock = ^{
[weakSelf doSomethingWhenThisBlockIsCalledFromWithinObject];
};
but I have also seen variants such as:
__weak __typeof__(self) weakSelf = self;
object.savedBlock = ^{
__typeof__(weakSelf) strongSelf = weakSelf;
[strongSelf doSomethingWhenThisBlockIsCalledFromWithinObject];
};
and I am not clear on why/when to do this last variant