1

Problem

After going through install instructions for Restkit on iOS, I'm receiving a Apple Mach-o linker error:

enter image description here

My Process

I tried to follow the Restkit install instructions found here: https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x

I added Restkit as a submodule through Git first.

I added Restkit to my project, and added the necessary configurations to the Project's Target build settings enter image description here enter image description here

I then added Restkit as a Target Dependency

enter image description here

Clues to the Solution

For whatever reason, a few files in Restkit are appearing in Red.

enter image description here

This results in similar behavior when linking the Restkit Framework

enter image description here

What I've Tried

  1. I tried deleting and readding Restkit to no avail.
  2. I've tried moving it within the Xcode project but this only made matters more strange (The target no longer recognized its dependancy to Restkit).
  3. I confirmed that what I've typed in the build settings was correct.
  4. I checked SO for the solution and even checked common solutions to Linker Errors Apple Mach-O Linker Error when compiling for device I did not see any apparent solutions (I may be wrong).

That's it. I do hope this is enough to solve the problem.

Edit: An extra image confirming the header search path:

enter image description here

Community
  • 1
  • 1
Rob Caraway
  • 3,856
  • 3
  • 30
  • 37

4 Answers4

1

Well, the solution is silly, but I realized that Restkit does not actually need the Restkit.framework to be built on iOS. It instead needs the libRestkit.a file to be added to the 'link binary with libraries' section.

This allows you to add <Restkit/Restkit.h> to your code with no compile errors or warnings.

Rob Caraway
  • 3,856
  • 3
  • 30
  • 37
0

You need to manually build the RestKit target for the header files to be copied into the build directory. Apparently the master project build does not reliably run the subproject build?

So, my steps for fixing this issue:

Select the RestKit run target
Build
Make sure the header search path was set on all target (apparently on project itself is not enough)
Build main project

For more step by step instruction go through this tutorial. Download the sourcecode code from here.

Vimal Venugopalan
  • 4,091
  • 3
  • 16
  • 25
  • Unfortunately, this did not clear up my problem. The header search path is included in the project and the target already. Edit: Unless you meant to add it to the RestKit Target search paths? – Rob Caraway Aug 24 '12 at 20:38
0

I had loads of issues trying to get this to work by downloading the projects, attempting to link them manually and so on. In the end I discovered cocoa pods which is a way of managing your dependencies. I followed this guide: http://www.raywenderlich.com/12139/introduction-to-cocoapods which helped me get up and running. After this process, the rest kit dependencies were introduced for me by cocoapods.

The Senator
  • 5,181
  • 2
  • 34
  • 49
0

It was all working for me on the computer where I created the project but when i copied project to a new computer i was getting this same error.

I figured that the reason was that xcode was not able to find the binaries created by cocoa pods. Its visible when you go to your targets project settings. So just drag the libPods.a from the Project navigator to the linked binaries and frameworks section of project settings. Take a look at the screen capture you can see both old and new one, its simple one step.enter image description here

Basically what this does is simply add the library search path

      LIBRARY_SEARCH_PATHS = (
                                   "$(inherited)",
                                   "$(PROJECT_DIR)/Pods/build/Debug-iphoneos",
                           );

:

vp_gold
  • 532
  • 4
  • 12