问题
Example #1
@property (nonatomic, copy) void (^errorBlock) (NSError *);
Example #2
@property (nonatomic, strong) void (^errorBlock) (NSError *);
I know that blocks are standard variables on stack, and by making a copy we are "moving" them to the heap.
Thats all? Or not?
回答1:
There should be no difference. Since the property has a block type, according to http://clang.llvm.org/docs/AutomaticReferenceCounting.html#blocks
With the exception of retains done as part of initializing a __strong parameter variable or reading a __weak variable, whenever these semantics call for retaining a value of block-pointer type, it has the effect of a Block_copy.
来源:https://stackoverflow.com/questions/16426382/what-is-the-main-difference-using-copy-and-strong-ownership-qualifiers-in-pr