Search code examples
iosobjective-ccore-datarestkit

Cannot configure RestKit with CoreData


I did setup my project to use RestKit and CoreData: added CoreData framework in 'Link binary with libraries' and "pod 'RestKit', '~> 0.24.0'" to my Podfile.

Everything looked fine until I tried to use RKObjectManager's method

managedObjectRequestOperationWithRequest:managedObjectContext:success:failure:

Xcode gives me the following error:

No visible @interface for 'RKObjectManager' declares the selector 'managedObjectRequestOperationWithRequest:managedObjectContext:success:failure:'

There is a #ifdef RKCoreDataIncluded preprocessor directive before this method in RKObjectManager.h, and RKCoreDataIncluded is defined this way:

#ifdef _COREDATADEFINES_H
#if __has_include("RKCoreData.h")
#define RKCoreDataIncluded
#import "RKManagedObjectStore.h"
#import "RKManagedObjectRequestOperation.h"
#endif
#endif

I can't figure out what else do I need to do to enable CoreData in RestKit?


Solution

  • As it turns out in order to use RestKit with CoreData you have to create precompiled header file for your project and add the following line:

    #import <CoreData/CoreData.h>
    

    This issue is discussed here: https://github.com/RestKit/RestKit/issues/1564