I have a BaseViewController which contains a property of type block:
typedef void (^result)(BOOL didSend);
@class ShakeView;
@interface BaseViewController : UIViewController
@property result mPlayerControlResultHandler;
@end
I want that this block can be accessible by other subclasses. So in viewDidLoad
of BaseViewController I did this to initialise the block:
- (void)viewDidLoad
{
[super viewDidLoad];
_mPlayerControlResultHandler = ^(BOOL didSend)
{
if(!didSend)
{
__block BaseViewController *blocksafeSelf = self;
[blocksafeSelf onOperatingSpeakerShortConnectionFailure];
}
};
}
This would throw a warning
Capturing self strongly in this block is likely to lead a retain cycle
So I searched for a solution this and tried everything suggested here but still unable to solve the problem.