Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

mistakenly use of NSPrivateQueueConcurrencyType #76

Closed
simpzan opened this Issue · 1 comment

2 participants

@simpzan

http://stackoverflow.com/questions/11436358/nsprivatequeueconcurrencytype-context-can-only-operate-within-performblock

when creating -managedObjectContext of XMPPCoreDataStorage. NSPrivateQueueConcurrencyType type is not correct here. NSPrivateQueueConcurrencyType context can only used with -performBlock...
the old NSConfinementConcurrencyType is appropriate for your code.
check up the doc: http://developer.apple.com/library/mac/#releasenotes/DataManagement/RN-CoreData/_index.html

the following is quoted from apple doc: http://developer.apple.com/library/ios/#releasenotes/General/WhatsNewIniPhoneOS/Articles/iOS5.html

"When sending messages to a context created with a queue association, you must use the performBlock: or performBlockAndWait: method if your code is not already executing on that queue (for the main queue type) or within the scope of a performBlock... invocation (for the private queue type). Within the blocks passed to those methods, you can use the methods of NSManagedObjectContext freely. "

@robbiehanson
Owner

Thanks for pointing this out to me.

You know, even after reading the documentation I'm still a bit confused. From what I understand (correct me if I'm wrong), the NSPrivateQueueConcurrencyType creates it's own private/internal queue. And we're supposed to then only access the context via performBlock: or performBlockAndWait:. But for some odd reason (IMO), it doesn't bother to enforce this rule?

At any rate, it sounds like you're absolutely correct. NSConfinementConcurrencyType is appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.