My question regards blocks in Objective-C: Assume the following situation (with ARC enabled):
typedef NSString*(^MyBlockType)();
typedef NSString*(^MyReturnBlockType)(MyBlockType);
- (MyReturnBlockType) foo: (MyBlockType) block
{
return ^NSString*(MyBlockType someBlock) {
return someBlock();
};
}
The parameter block
that is received by the method foo:
is used within the block that is returned by the method. However, who keeps a strong reference to the block
? Should foo:
copy the block before returning the MyReturnBlockType
-block? Any insight would be appreciated.