Re: CoreData headaches
Re: CoreData headaches
- Subject: Re: CoreData headaches
- From: Dave Fernandes <email@hidden>
- Date: Thu, 27 Oct 2016 20:00:14 -0400
> On Oct 27, 2016, at 5:24 PM, Steve Mills <email@hidden> wrote:
>
> I have an app that uses CoreData to store document data, and an IKImageBrowserView to display the items in the CoreData. Finding that IKImageBrowserView is being deprecated, and since Xcode 8 causes a goofy scrolling bug that the user can't work around, I decided to move away from IKImageBrowserView and reimplement the display as an NSCollectionView. OK, that works. In order to match the speed at which IKImageBrowserView builds thumbnails in the background, I used an NSOperationQueue in which to load each thumbnail via CGImageSourceCreateThumbnailAtIndex. This mostly works fine, except I get random crashes when accessing properties of a NSManagedObject (the image file's folder's url and image file's name). Any suggestions for making this work correctly? I'm just hacking at it right now by adding @synchronize() wrappers around code, but it's not helping.
Are you accessing the properties from within a NSManagedObjectContext.performBlock block? Sounds like you may be accessing the managed objects from the wrong queue.
>
> Since CoreData and managed objects are full of so much voodoo (and because it's been a long time since I originally wrote this app, so the CoreData stuff is pretty fuzzy by now), I wonder if there isn't a better system I could use to store document data. The app is an image organizer that can store references to thousands of images and movies (not the actual images), sort and filter them any number of ways (which is all handled by an NSArrayController), and tag them with keywords (also NSManagedObject).
>
> What does CoreData give me that I can't get by simply archiving an array of NSDictionary? Well, aside from undo, writing only changed objects to the file, and all the rest of the stuff it does.
I think you just answered your own question. The relationship management and delete rules are also helpful — there is less bookkeeping for you to do.
>
> The previous version of the app used my own file format. I don't recall it being particularly slow or featureless. Hmm.
If you aren’t dealing with large numbers of objects, then all the optimizations in Core Data may not be important to you.
>
> --
> Steve Mills
> Drummer, Mac geek
>
>
> _______________________________________________
>
> 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
_______________________________________________
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