One Quickie

Storing Images into the data store (Core Data->General)
So ya want to store an image into the data store. mmalc says

Don't use the XML store, but instead use the SQLite store

If an entity has a large data blob as an attribute, you should make a separate entity for that attribute.

e.g. a Person has a 'photo' attribute. Create a Photo entity with a single attribute (the data) and a relationship back to the person (if it makes sense, usually it does), and a relationship from the Person to the Photo entity.

This means that the photo data will only be loaded from the persistent store if you actually use it.

(markd: this also has the nice side effect of letting the db put all the blob data elsewhere, rather than in with the other data, giving you better locality of reference to your Person data without slogging through all the Photo jazz if you don't need it)

borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book