Re: performSelectorOnMainThread problem SOLVED
Re: performSelectorOnMainThread problem SOLVED
- Subject: Re: performSelectorOnMainThread problem SOLVED
- From: Jason Foreman <email@hidden>
- Date: Thu, 28 May 2009 12:18:41 -0500
On May 28, 2009, at 12:13 PM, Ben Einstein wrote:
Thanks for the advice, I had actually tried that as well to no avail.
After playing around a bit, I'm fairly certain I've solved it,
although I'm not really sure why it was a problem. At the top of the
worker method, I was locking the NSManagedObjectContext and
unlocking it just before return, but all the NSManagedObject stuff
should be happening on a separate thread. I'll try to track that
down in a minute, but it appears that was blocking the main thread.
I suppose I should have asked Instruments before asking you all.
Hi Ben,
FYI, sharing an NSManagedObjectContext between threads is discouraged
("strongly discouraged" according the the docs). The recommended
approach is to create separate contexts on each thread, which might
help avoid problems like you've just had:
<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html
>
Jason
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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