I am currently syncing my entire master data store with iCloud so that the same data is available on all iOS devices of users. All of this is configured using MagicalRecord by doing the following:
[MagicalRecord setupCoreDataStackWithiCloudContainer:@"xxxxxxx.com.mydomain.MyAppName" localStoreNamed:@"MyAppName"];
However, I would like to store some device-specific objects in the database. It is mainly used for caching information received from the Internet, and I do not want this to take up space in the iCloud user account.
I believe that there would be two ways to do this:
- Choose which database tables should be synchronized and ignore tables used for device-specific objects.
- Ask MagicalRecord to manage multiple databases and store objects that need to be synchronized in one database and another device in another.
I do not know if any of these two methods is possible or which will be easiest to support and / or implement.
Does anyone know if this is possible and how it can be done? Sample code is welcome.
UPDATE
I try to follow the approach suggested by casademora below , but at the same time both of my stores end up with beign synchronized with iCloud. I added the following to application:didFinishLaunchingWithOptions:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [MagicalRecord setupCoreDataStackWithiCloudContainer:@"xxxxxxxxx.com.mydomain.MyAppName" localStoreNamed:@"MyAppName_iCloud"]; [[NSPersistentStoreCoordinator coordinatorWithInMemoryStore] addSqliteStoreNamed:@"MyAppName" withOptions:nil];
I added two data models to the project. One of them is called MyAppName_iCloud.xcdatamodeld and one named MyAppName.xcdatamodeld.
I would like the MyAppName repository to sync with iCloud.
source share