我有一个具有指向块的属性的对象:
typedef void (^ThingSetter)();
@property(nonatomic, strong) ThingSetter setup;
我用一个块初始化属性。在block
I 中指的是对象实例:
Thing *thing = [[Thing alloc] init];
thing.setup = ^() {
plainOleCFunction(thing.number);
[thing doSomethingWithString:@"foobar"];
};
但是,我收到有关保留循环的编译警告:
capturing 'thing' strongly in this block is likely to lead to a retain cycle
block will be retained by the captured object
这样做的正确方法是什么?
谢谢,道格