Skip to content

Instantly share code, notes, and snippets.

@alanjrogers
Created October 4, 2011 04:23
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 alanjrogers/1260899 to your computer and use it in GitHub Desktop.
Save alanjrogers/1260899 to your computer and use it in GitHub Desktop.
Question regarding private queue concurrency
__block NSManagedObject* object = nil;
[privateQueueContext performBlockAndWait:^{
object = [SomeClass methodThatExecutesFetchRequestReturningObjectUsingContext:privateQueueContext];
}];
// Is it safe to use object here?
NSLog(@"object: %@", object);
@alanjrogers
Copy link
Author

Current answer is: "probably not" ;)

@keithduncan
Copy link

I think you're correct, using the managed object outside that block violates the containment protocol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment