I'm trying to learn Core Data. I have a working document model hooked up to a 
table view (OS X). I have an import method that uses FSDirectoryEnumerator to 
add an object for each file in the folder. Oky doke! But that blocks for a few 
seconds while it loops. So I'm trying to make it threaded. One example I saw 
uses GCD. It kinda seemed to work when I had a bunch of printfs in there so I 
could watch it progress, but when I took them out it just crashed at some 
point, and it still blocked any sort of user events.

Next I tried sticking the entire import operation into a block via 
NSOperationQueue's addOperationWithBlock:. That throws because some set was 
being changed by multiple threads. Then I tried the suggestion of using a 
private NSManagedObjectContext in the block. That got me somewhere, but of 
course the data didn't populate my table. I tried the 
NSManagedObjectContextDidSaveNotification trick, but I couldn't get that to 
work.

Reading the Concurrency with Core Data page online says the information is 
outdated. Where do I find current documentation? Or better yet, an actual 
example that actually works? My brain is about to explode, and nobody wants to 
clean that up.

--
Steve Mills
Drummer, Mac geek


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to