weakSelf ( weakSelf - strongSelf). , , , weakSelf ( ).
, , , . ( , , , . Lol.) , , . , .
strong ( ), .
.
:
, .
__weak __typeof(self) weak_self = self;
void(^completionBlock)(void) = ^(){
__typeof(self) strong_self = weak_self;
if (strong_self) {
if (strong_self->_completion != NULL) {
strong_self->_completion();
}
}
};
, self .
, ( " " , "). . , .
, (weakSelf strongSelf, weak_self strong_self). __ __typeof. , . , - :
__weak typeof(self) weakSelf = self;
void(^completionBlock)(void) = ^(){
typeof(self) strongSelf = weakSelf;
if (strongSelf) {
if (strongSelf.completion != NULL) {
strongSelf.completion();
}
}
};
, , , . , , , , , " " .
:
__block __typeof(self) block_self = self;
, . " " , ( ), ARC __block , . , , ARC, block_self , ARC.
, :
__weak __typeof(self) weak_self = self;
self.completionBlock = ^(){
if (weak_self->_completion != NULL) {
weak_self->_completion();
}
};
. -, . weak_self nil, . -, , , ivars, , .
, " " . , " " , " . , MCVE, . ARC .