Unlike blocks, methods are not objects; they cannot hold a permanent reference to objects.
Your code would not cause a retain cycle. The fact that the code inside doSecond
references self
explicitly does not mean that self
would get retained an extra time. When your block calls doSecond
, its self
comes from the weakSelf
reference inside doFirst
.
Note: When you store blocks as properties, use (nonatomic, copy)
instead of (nonatomic, strong)
.