In my Core Data model (on iPhone SDK 3.1) I have several entities that are associated with the same instance of an image. The image itself is also stored as managed object. In order to save disk space, I'm trying to create 1 db file for the images and another db file for all other objects.
Reading Apple's documentation and googling for days I came to the following conclusion: - Create 1 datamodel that contains the description of all entities - Use 1 persistent store coordinator
Use configurations to store image entities in a different file (sqlite) than the other entities (see here)
And, as Core Data does not support relationships from instances in one persistent store to instances in another persistent store, use "Fetched Properties" to create weak, one-way relationships
Using configurations is pretty straightforward: assign a configuration to the entity using the data modeler and declare which configuration to use when adding a persistent store to the coordinator. In my case, I added to stores to the coordinator.
But here's the problem: when fetching, let's say 'User' objects from one store, how do I use fetched properties to load the images associated with that user (and assign them to the user object)?
Do I have to write a custom accessor method for 'images' in the user object? How (and where) to specify the predicate for the fetched property?
I was convinced there must be a tutorial or example explaining this (as this obviously is the way Apple suggests to do it). But no luck so far.
Any idea?
Hopefully we can start a discussion on this topic. I'm sure there are other (more clever) ways to solve this...