Created
April 28, 2014 15:27
-
-
Save jeffbailey/11375441 to your computer and use it in GitHub Desktop.
Example of capturing a weak reference in a block and converting to a strong reference when the block executes.
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
__weak typeof(self) weakSelf = self; | |
[self doABlockOperation:^{ | |
__strong typeof(weakSelf) strongSelf = weakSelf; | |
if (strongSelf) { | |
... | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment