In my Core Data model (on the iPhone SDK 3.1), I have several objects that are associated with the same image instance. The image itself is also saved as a managed entity. To save disk space, I am trying to create 1 db file for images and another db file for all other objects.
Reading Apple documentation and searches for several days, I came to the following conclusion: - Create 1 datamodel that contains a description of all objects - Use 1 permanent store coordinator
Use configurations to store image objects in a different file (sqlite) than other objects (see here )
And since Core Data does not support relationships from instances in one persistent store with instances in another persistent store, use "Corrected Properties" to create weak one-way relationships
Using configurations is quite simple: assign an entity configuration using simulated data and declare which configuration to use when adding persistent storage to the coordinator. In my case, I added a coordinator to the stores.
But here's the problem: when retrieving, say, User objects from a single repository, how to use the loaded properties to load the images associated with this user (and assign them to the user object)?
Should I write a custom access method for "images" in a custom object? How (and where) to specify a predicate for a selected property?
I was convinced that there should be a tutorial or an example explaining this (it is so obvious that Apple suggests doing this). But so far no luck.
Any idea?
I hope we can start a discussion on this topic. I am sure there are other (smarter) ways to solve this problem ...
source
share