Reputation: 1702
I'm using the core data for fetching/ saving the data. In my application, I use 90 % of core data and 10 % with web services API. Currently, I'm working on optimization. Earlier I tried with NSOperationQueue and GCD operations. I found - performBlock: and - performBlockAndWait: to resolve the thread operations and asynchronous(background) process. This was more suitable for my code. I initiated managedobjectContext with concurrencytype as NSPrivateQueueConcurrencyType.
**Is it good to have NSPrivateQueueConcurrencyType alone throughout the application ? **
NSManagedObjectContext *private = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
Upvotes: 0
Views: 145
Reputation: 70986
It's OK to use NSPrivateQueueConcurrencyType
everywhere. It might not be convenient but that's up to you.
The advantage of NSMainQueueConcurrencyType
is that if your code is running on the main queue, you don't need performBlock
or performBlockAndWait
. Those methods would just run the block on the main queue, but when you're already on the main queue, that doesn't make a difference. This can make UI-related code simpler. Whether to use it is your call, depending on what you find convenient to do in your code.
Upvotes: 2