Skip to content

Instantly share code, notes, and snippets.

@lemonkey
Forked from quellish/waitForBlock.m
Created October 28, 2016 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lemonkey/68bf8c3fadbb84663c47892f56f1a5a2 to your computer and use it in GitHub Desktop.
Save lemonkey/68bf8c3fadbb84663c47892f56f1a5a2 to your computer and use it in GitHub Desktop.
Pseudo-sample of synchronous use of Core Data performBlock: using dispatch group
group = dispatch_group_create();
dispatch_group_enter(group);
[context performBlock:^{
result = [context executeFetch:...
dispatch_group_leave(group);
}];
groupResult = dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment