Use RestKit while keeping MagicRecord for rest of fetches and updates

74 views
Skip to first unread message

Angelo K. Huang

unread,
Jul 16, 2012, 4:18:22 AM7/16/12
to res...@googlegroups.com
I want to keep using my current RestKit while use MagicRecord for rest of fetches and updates. I want Restkit's MOC send updates to MagicRecord's default context. If I understand right, this is what I am doing. Is this ok?

    NSManagedObjectContext* context = [[RKObjectManager sharedManager].objectStore managedObjectContextForCurrentThread];
    [MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:[XDBStore storeName]];
    [context setParentContext:[NSManagedObjectContext MR_defaultContext]];

Angelo K. Huang

unread,
Jul 16, 2012, 5:26:54 AM7/16/12
to res...@googlegroups.com
I found another way to do it, but still not sure.

    NSPersistentStoreCoordinator *coordinator = [[[RKObjectManager sharedManager] objectStore] persistentStoreCoordinator]; 

    [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; 

    [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator];

Angelo K. Huang

unread,
Jul 19, 2012, 8:56:47 PM7/19/12
to res...@googlegroups.com
Anyone had same issue before?
Reply all
Reply to author
Forward
0 new messages