automatic ref counting - Access Stack Block from within Block using ARC in Objective-C -
my question regards blocks in objective-c: assume 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 received method foo: used within block returned method. however, keeps strong reference block? should foo: copy block before returning myreturnblocktype-block? insight appreciated.
the parameter
blocknot used anywhere in code.let's supposed meant use
blockinsidesomeblock. variables of object pointer type captured block retained when block copied. furthermore, variables of block pointer type captured block copied when block copied. so, whensomeblockcopied,blockcopied.in arc, stack block returned directly automatically copied before returning. thus,
someblock, ,block, caused copied.no,
foo:not need explicitly copyblock, because not doing explicitly store (in instance variable or something).
Comments
Post a Comment