O'Reilly logo

RestKit for iOS by Taras Kalapun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring

Before using RestKit with Core Data, be sure to check that the Core Data library is linked to your project's target and you have added #import <CoreData/CoreData.h> before importing RestKit; for example, in the application's Prefix.pch file:

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import <SystemConfiguration/SystemConfiguration.h>
    #import <CoreData/CoreData.h>
    #import <RestKit/RestKit.h>
#endif

The configuration of RestKit to use Core Data is quite similar if you would use Core Data without it. Create the (void)setupCoreData method:

// Configure RestKit's Core Data stack NSURL *modelURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"MongoHq" ofType:@"momd"]]; // Due to an iOS 5 bug, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required