ios - Can two weak variables create a retain cycle? -
in arc, if hold strong reference b, , b holds strong ref a, there retain cycle.
will code below create retain cycle?
__weak myclass *weakself = self; [self dosomething:^{ weakself.somevariable = yes; [weakself dosomething:^{ weakself.somevariable = yes; }]; }];
with arc weakself pointer copied, since it's weak, copy of pointer not cause retain count increased. no, doesn't create retain cycle.
Comments
Post a Comment