I have the following block declared in a .h
@property (strong, nonatomic) void(^setHandedness)(BOOL hand);
it is defined in the matching .m
setHandedness = ^(BOOL hand){
_isRightHanded = hand;
};
and is passes to a child view controller which has the same form of block declared. Except with weak
@property (weak, nonatomic) void(^setHandedness)(BOOL hand);
Replacing strong with weak removes the warning. But I don’t understand why?
the block is then called in the child view controller
setHandedness(handedness);
I have a warning telling me self is likely to cause a retain cycle? any ideas. Cheers.
The reason for the warning is this:
Now you have two objects referencing each other. Even if no one else references them they will keep each other alive and never be deallocated.
Here is a quote from Apple’s documentation for blocks and variables
Your second view controller has nothing to do with your retain cycle.