Created
April 7, 2019 21:35
-
-
Save romyilano/bdfc6320e099dfae0c120dc150b8f74d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/questions/23806751/strong-reference-to-a-weak-references-inside-blocks | |
__weak typeof(self) weakSelf = self; | |
void (^someBlock)(id) = ^(id data){ | |
if (weakSelf != nil) { | |
// last remaining strong reference released by another thread. | |
// weakSelf is now set to nil. | |
[myArray addObject:weakSelf]; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment