Hi

Sorry, I wasn't explicit enough in my mail - my operation does have it's own
context, and when I fetch against it, awakeFromFetch is not sent, so my
initialization code doesn't get executed. The operation is added to a custom
(i.e. not main one) NSOperationQueue, which does have max concurrency > 1.
Hmm - I thought *every* NSOperation needs it's own managed object context,
even if used in operation queue with max concurrency == 1 as it still gets
executed "concurrently" regarding to main thread?

Anyway I've solved my problem by lazily creating required objects and use a
bit more complicated mechanisms to pass exact instances from main thread to
my operation (this is primarily used for unit testing where I need to inject
non-default objects and I can only do this prior than executing the code).

However I still don't understand why awakeFromFetch is not sent in secondary
thread - I can't find any clue in documentation? Is this a bug or is it a
feature? I'm running on 10.6.2.

Thanks, Tom

On 15 March 2010 20:36, Ben Trumbull <trumb...@apple.com> wrote:

>
> Does the secondary thread have its own private NSManagedObjectContext that
> you are using for the fetch, or are you fetching against an
> NSManagedObjectContext that was created on another thread ?  If you are
> using an NSOperationQueue with maxConcurrency > 1, then each NSOperation
> will need to allocate, use, and deallocate its own NSManagedObjectContext.
>
> - Ben
>
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to