我有以下目标:
Someobject *Object = [[Someobject alloc] init];
void (^Block)() = ^()
{
Use(Object);
};
DoSomethingWith(Block);
The block is copied in DoSomethingWith
and stored somewhere. it might either not be called, called once or called multiple times. I want to tie Object
with the block so whenever the block or any of its copies is released, Object
is released, and whenever the block or any of its copies is retained or copied, Object
will be retained.
Is there a way to do so?