Re: Weird Core Data crash
Re: Weird Core Data crash
- Subject: Re: Weird Core Data crash
- From: Kyle Sluder <email@hidden>
- Date: Wed, 30 Nov 2011 07:56:58 -0800
If you're targeting 10.7, you can use the new NSManagedObjectContext
concurrency support:
http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/coredata/Articles/cdConcurrency.html#//apple_ref/doc/uid/TP40003385-SW1
--Kyle Sluder
On Wed, Nov 30, 2011 at 7:41 AM, Andrew Kinnie <email@hidden> wrote:
> OK. Thanks. (I'd have responded sooner but I was driving all day)
>
> I will look into this. It does appear that I was not being precise enough with the MOC on potential multiple threads. So we should probably have a moc on the main thread (for queries, etc) and have transient background thread based mocs for the fairly heavy lifting.
>
> Thanks again.
>
> Andrew
>
> On Nov 29, 2011, at 8:51 AM, Fritz Anderson wrote:
>
>> On 29 Nov 2011, at 7:21 AM, Andrew Kinnie wrote:
>>
>>> This method may be called from the main thread or from a background thread, but is always called using performSelectorInBackground.
>>
>> It's not enough that you divert the call to _a_ background thread. You must send it to _the_ background thread that owns the managed-object context.
>>
>> If necessary (you can't exchange the data between threads through non-CD immutable types), each thread that does business with your persistent store should have its own MOC, coordinate its content with NSManagedObjectContextDidSaveNotification, and query/update the store only through its MOC.
>>
>> — F
>>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden