🌟用__unsafe_unretained解决
__unsafe_unretained typeof(self) weakSelf = self;
self.block = ^{
NSLog(@"age is %d", weakSelf.age);
};
🌟用__block解决
__block id weakSelf = self;
self.block = ^{
printf("%p",weakSelf);
};
🌟用__unsafe_unretained解决
__unsafe_unretained typeof(self) weakSelf = self;
self.block = ^{
NSLog(@"age is %d", weakSelf.age);
};
🌟用__block解决
__block id weakSelf = self;
self.block = ^{
printf("%p",weakSelf);
};
本文标题:解决block循环引用--MRC
本文链接:https://www.haomeiwen.com/subject/vqnyvhtx.html
网友评论