Created
December 14, 2011 21:55
-
-
Save hramos/1478741 to your computer and use it in GitHub Desktop.
Compile time check for blocks that is of no use when min. target < 4.0 anyway
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
#ifdef NS_BLOCKS_AVAILABLE | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ | |
#endif | |
// background stuff | |
#ifdef NS_BLOCKS_AVAILABLE | |
dispatch_sync(dispatch_get_main_queue(), ^(void) { | |
#endif | |
// main thread stuff | |
#ifdef NS_BLOCKS_AVAILABLE | |
}); | |
}); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem: checking against NS_BLOCKS_AVAILABLE at compile time will of course work on a 4.0 or 5.0 SDK app, this is something that needs to be checked at runtime instead - see https://gist.github.com/1478748