Will ARC tell me when should I use __block?

AFAIK, __blockused when you change the address inside the block that the variable points to (declared outside the block).

But what if I change the value the variable points to, but the pointer remains unchanged? For example, what if I have NSMutableArray *arrayand I just do [array addObject:object]inside the block? In this case, I do not change the pointer array, but I change the value that it points to. So should I use __blockwhen declaring NSMutableArray *array?

+5
source share
1 answer

__block, .

.. :

NSArray* foo;

__block, foo. , foo - , " , NSArray". foo - 64- 32- , . , __block. , __block.

, , __block addObject: , foo.

- foo = (expression);, __block.

( , , OO ... " " )

+19

All Articles