4.Block中调用成员函数 retain cycle
2014-04-09 本文已影响56人
Jingwei
原因:
我也不知道,可能引用技术的问题吧。
解决:
错误:
_avatar.touchBlock = ^{
[self showMenu]; // Capturing 'self' strongly in this block is likely to lead to retain cycle
};
正确:
__weak id weakSelf = self;
_avatar.touchBlock = ^{
[weakSelf showMenu]; // it's OK
};
要说的话:
这里面闹不清楚,我也不想闹清楚,oc我只是写app而已,不想研究的多深,不过根据个人感觉,应该是智能指针 shared_per weak_ptr那些东西造成的。