ARC, ivars in Blocks and Reference Cycles via Captured Self

前端 未结 2 1487
忘了有多久
忘了有多久 2020-12-23 11:51

I’m working in a pure iOS5/ARC environment, so I can use __weak references as needed. I do reference ivars in a block in many situations, most notably, animation blocks that

2条回答
  •  春和景丽
    2020-12-23 12:56

    There is only a cycle here if self then goes on to hold a reference to the block (or something owned by self). If not you're good to go as the lifetime of the block is not dictated by the self it retained.

    So in your particular example, you seem to be in the clear. Animation blocks don't need to participate in the weak/strong self dance.

提交回复
热议问题