Skip to content
This repository

RestKit Installation on Xcode 4.x as a Git Submodule

Outdated Warning

This document covers RestKit v0.10.x. If you are looking for v0.20.x, please refer to: Installing RestKit v0.20.x as a Git Submodule

This document describes the installation process for getting RestKit installed into an iOS project built using Xcode 4.x. If you have trouble building or running your app after completing the guide, please refer to the Installation Troubleshooting wiki page.

Adding the Submodule

We recommend using a Git submodule to manage your installation of RestKit. The first step to installation is to add the submodule to your project:

$ cd /path/to/MyApplication
# If this is a new project, initialize git...
$ git init
$ git submodule add git://github.com/RestKit/RestKit.git
$ open RestKit

You can substitute an alternative branch (i.e. development) via the -b switch to the git submodule invocation. (i.e. git submodule add -b development git://github.com/RestKit/RestKit.git) Add Submodule

Adding RestKit to Your Project

Now that you have cloned RestKit into your project, you need to let your project know about RestKit by adding it to your project Workspace. Find the RestKit.xcodeproj file inside of the cloned RestKit project directory and drag it into the Project Navigator (⌘+1). Add Project Dependency

Configuring Your Target

Now that your project is aware of RestKit, you need to configure a few settings and add some required Frameworks to your project's build configuration. Click on the top-most item in the Project Navigator to open the Project and Targets configuration pane.

Then click on the Build Settings item and input "other linker flags" into the search text box in the top right of the main editing pane. Double click on the build Setting titled Other Linker Flags. A panel will pop open prompting you to input the Linker Flags you wish to add. Input -ObjC -all_load and hit Done.

NOTE: Try removing the -all_load flag if you are receiving runtime errors related to selectors not being found, even though you followed all the steps faithfully.

Add Linker Flag

After configuring the Linker Flag, clear the text from the search box and input "header search path". Double click on the build setting titled Header Search Paths. A panel will pop open prompting you to input the Header Search Path you wish to add. Input "$(BUILT_PRODUCTS_DIR)/../../Headers". Be sure to include the surrounding quotes (-- they are important!) and hit Done. Add Header Search Path

Now click on the Build Phases tab and click the disclosure triangle next to the item titled Target Dependencies. A sheet will pop open asking you to select the target you want to add a dependency on. Click the RestKit (for iOS) OR RestKitFramework (for OS X) target and hit the Add button. Add Target DependencySelect RestKit Target

Once the Target Dependency has been configured, you now need to link the RestKit static libraries and the required Frameworks into your target. Click the disclosure triangle next to the item labeled Link Binary With Libraries and click the plus button: Add Libraries

Select the RestKit static libraries appropriate for your configuration. The appropriate libraries to select depends on the version you are installing. If you are installing RestKit from the current master version, then you only need to select one of two products:

  • libRestKit.a - RestKit for iOS static library
  • RestKit.framework - RestKit for OS X framework

Select RestKit Static Libraries

Now you need to add linkage to the required Apple provided frameworks as well. Click the plus button again and select the following Frameworks from the iOS section of the framework selection sheet:

  • CFNetwork.framework on iOS
  • CoreData.framework
  • MobileCoreServices.framework on iOS or CoreServices.framework on OS X
  • Security.framework
  • SystemConfiguration.framework
  • QuartzCore.framework on iOS
  • libxml2.dylib

Select Required Frameworks

You have now completed installation of RestKit into your application. To verify the installation, open up your App Delegate and add an import of the RestKit header:

#import <RestKit/RestKit.h>

Build your project (⌘+B) and then switch to the Log Navigator view (⌘+7) and verify the build output. Your project should build cleanly without any issues. Congratulations! You have now successfully installed RestKit!

Add Import to App DelegateVerify Build

Something went wrong with that request. Please try again.