I know this question has been asked before, but non of the solutions solve my problem, so I’m asking this again. I am trying to call a method on self as the result of a callback through a block. I’m getting the following error:
Capturing ‘self’ strongly in this block is likely to lead a retain cycle
- (void)viewDidLoad {
[super viewDidLoad];
self.webClient.completionHandler = ^{
[self populateData];
};
}
I tried doing something like the code below, and I’m still getting the same warning.
What’s the solution?
__weak id myself = self;
[myself populateData];
Your code should look like this: