Search code examples
iosobjective-crestkitmagicalrecord

what's the next of RKManagedObject in RestKit


I just read the tutorial on github, and found some object methods about Core Data, for example, fetchRequest, objectWithPrimaryKeyValue and so on. Then I googled them, all of them come from RKManagedObject, which has been deprecated in the latest version of Restkit, so do current version of Restkit provide similar API of NSManagedObject?

Or should I just involve third-party project, such as MagicalRecord? If so, I'm not sure whether they are compatible, since core data is handled by RestKit heavily. For example, If I want to use MagicalRecord, I need to init it with one of below method according to official doc. And my application will have two main contexts I guess, one is handled by RestKit, another is handled by MagicalRecord.

+ (void)setupCoreDataStack;
+ (void)setupAutoMigratingCoreDataStack;
+ (void)setupCoreDataStackWithInMemoryStore;
+ (void)setupCoreDataStackWithStoreNamed:(NSString *)storeName;
+ (void)setupCoreDataStackWithAutoMigratingSqliteStoreNamed:(NSString *)storeName;
+ (void)setupCoreDataStackWithStoreAtURL:(NSURL *)storeURL;
+ (void)setupCoreDataStackWithAutoMigratingSqliteStoreAtURL:(NSURL *)storeURL;

Solution

  • Restkit is for mapping, not to provide a different interface to core data. As such you get a few things, like saving support, in NSManagedObjectContext+RKAdditions.h but nothing else.

    You should look at using mogenerator for sure and consider magical record if there are other things you want that it provides.