Skip to content

Installation Troubleshooting

blakewatters edited this page Dec 8, 2011 · 9 revisions

If you are having trouble with your RestKit installation, try the troubleshooting steps below....

Problem: #import <RestKit/RestKit.h> Fails

If the import of the RestKit header fails, your project may not be building using the Derived Data directory. Beginning with Xcode 4.0, projects and workspaces can place their build products into a common tree of directories outside of the project source tree. RestKit leverages this build environment to provide header include paths.

Solution: Reconfigure Your Build Location

Select the File > Project Settings… menu item to open the project settings sheet:

Open Project Settings

A sheet will appear containing a Build and a Snapshots tab. On the Build tab, select the Advanced… button: Open Project Settings

A new sheet will appear containing a pop-up menu for the Build Location. Select the Derived Data Location from the menu and then press the Done button to dismiss the sheet.

Open Project Settings

Solution: Check out a stable release

If you set up RestKit in your project using git it is likely that you're compiling against the master branch, which can be unstable. Instead, try checking out the last known stable release using tags:

RestKit (master)$ git tag -l
0.9.0
0.9.1
0.9.1.1
0.9.2
0.9.3
RestKit (master)$ git checkout 0.9.3
Note: checking out '0.9.3'.

You are in 'detached HEAD' state. You can look around, make experimental...

Problem: My Code Completion Stopped Working

Xcode 4 is known to suffer from a variety of code completion indexing issues that pop up from time to time. If your code completion stops working, there are a few things that may help:

Solution: Cleaning the Build Folder

Hold down the option key and select the Product menu > Clean Build Folder… option to rebuild your indexes. Clean Build Folder

Solution: Rebuilding Derived Data

Deploy the nuclear option by completely rebuilding the Derived Data directory for your project. To do this, close out your project in Xcode and then display the Organizer by selecting the Window menu > Organizer. Find your project in the list on the left and click it. Find the Delete… button in the main panel on the right of the window. Now quit Xcode, relaunch it and reopen your project. The index will rebuild and your code completion may return. Delete Derived Data

Solution: Check your Build Settings

Xcode's indexing issues are seemingly aggravated by certain configurations. It is recommended that you update your application's project configuration in the following ways:

  1. Eliminate relative search paths. If you need to add an header, framework, or library search path. Do not use a relative path. Instead, use the $(SOURCE_ROOT) environment variable to construct an absolute path that is nested underneath your project's root directory. So rather than adding a Header Search Path to ../Libraries/, change it to "$(SOURCE_ROOT)/../Libraries".
  2. Eliminate recursive search paths. Do not use the Recursive checkbox when adding header, framework, or library search paths. Add multiple absolute paths to the directories that contain your needed headers or target a parent directory and import the headers using the full path.
  3. Enclose your import paths in quotes. As above, rather than adding a Header Search Path to ../Libraries/, change it to "$(SOURCE_ROOT)/../Libraries".

Solution: Build using LLVM

If you are using the GCC compiler then switching to LLVM may alleviate your indexing issues.

Solution: Use Xcode 3.2 Project Format

If your project is old, then you may eliminate some indexing weirdness by updating to the Xcode 3.2 format. This is done by by selecting the View > Navigators > Project Navigator menu item, then showing the Utilities in the right hand panel by selecting the View > Utilities > Show Utilities and clicking on your project in the Project navigator panel on the left of the Xcode window. In the right panel, you will see a Project Format menu. Select Xcode 3.2-compatible.

Problem: Static Library Build Products Appear in Red

After adding RestKit to my project, I have these static libraries appearing in red in my project. What gives?

Solution: Hide & Ignore Them

Since the release of Xcode 4 this annoyance has been around. Though the libraries appear in red, they actually build and are linked correctly into your application. If you have no other problems, this can safely be ignored as a cosmetic issue. We recommend hiding them in a group in your project like Frameworks.

Solution: Upgrade to Xcode 4.2

As of beta 7, Xcode 4.2 no longer seems to suffer from this issue and does not add red static library build products to your application's project. You may need to explicitly delete them and re-add to your project to remove them after updating.

Problem: "Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1"

Solution: Check Your Targets

Be sure that you are linking against the appropriate build product for your platform.

On iOS, you want libRestKit.a. On OS X, you want RestKit.framework.

Problem: "command /bin/sh failed with exit code 2"

Solution: Check the Git autocrlf configuration

Xcode may fail to execute the shell scripts at the end of the RestKit build process if Git is configured to use core.autocrlf. The script files in the repository have Unix line endings and will be mangled if autocrlf is enabled. If you run into this issue, reconfigured git to use core.autocrlf=input.

Clone this wiki locally