7

THIS QUESTION REFERS TO RESTKIT 0.9.x.

IF YOU ARE NEW TO RESTKIT CONSIDER USING THE NEWER 0.10.x branch.

I recently inherited a project that uses (restkit.org). I have started using a branch (402-new-build-process) that is more compatible with .

My project an all the example projects build and run, but when it comes to Archiving an app the build fails:

/Users/AUser/Documents/SubFolder/stable-branches/project-iOS-client/RestKit/Examples/RKTwitterCoreData/Classes/RKTwitterAppDelegate.m:9:9: fatal error: 'RestKit/RestKit.h' file not found [2]
 #import <RestKit/RestKit.h>
         ^
1 error generated.

Xcode - failed to archive rest kit example project

I have followed the Installation Troubleshooting guide on the project wiki, but this did not work.

As per Blake's answer I am building to the DerivedData directory:

DerivedData directory settings

In addition I have tried setting header search to these (in many combinations [just guesses]):

"$(BUILD_DIR)/RestKit/Build"
"$(SOURCE_ROOT)/RestKit/Build"
"$(SOURCE_ROOT)/../../Build"
"$(BUILD_DIR)/../../Build"

Community
  • 1
  • 1
Richard Stelling
  • 25,607
  • 27
  • 108
  • 188

8 Answers8

7

I think all these fixes were stabs in the dark, or at least felt like that to me. I half expected to read one about getting some hair from a young virgin and burning it over the Mac.

If it compiles for you in dev but not for archive its bound to be something simple. Or at least it was for me.

My source files were not in the right place:

The search header was set to "$(SOURCE_ROOT)/RestKit/Build"

But I had simply dragged the proj file from where I downloaded it into XCode. This was never an issue when compiling for debug etc. Just when archiving so I didnt spot it for a while.

Just make sure what ever that path is to the RestKit/Build is where the actual files are.

Fixed it for me, unlike all the cross your finger fixes I've read. Like moving headers into a group etc... what a load of rubbish that was.

Good luck, hope this helps. Thanks to the Restkit team, this really is a great framework.

Jamie

  • 1
    Just double check where did you add the RestKit submodule. In my case the path was "$(SOURCE_ROOT)/../RestKit/Build". – defvol Feb 17 '12 at 18:49
  • 1
    One thing I'm finding about iOS development is that there's an awful lot of dead chicken waving. Fragile dev environment. – Brian Knoblauch Nov 28 '12 at 19:20
3

I am building against the development branch and integrate RestKit as a submodule in my root git folder

+ root project folder
|--+ RestKit
|--+ <Projectname> 
   |--+ <Projectname>.xcodeproj

So I use the following search paths

"$(BUILT_PRODUCTS_DIR)/../../Headers"
"$(SOURCE_ROOT)/../RestKit/Build"
vinzenzweber
  • 3,379
  • 4
  • 24
  • 26
2

!!!Update to the latest version of the branch!!!

I've just built RKCatalog and RKTwitterCoreData as an archive on Xcode 4.2 without issue. I am failing due to a Code Signing issue. Have you confirmed that you are building with the DerivedData directory:

RestKit assumes that you are using a modern Xcode project building to the DerivedData directory. Confirm your settings via the "File" menu > "Project Settings...". On the "Build" tab within the sheet that opens, click the "Advanced..." button and confirm that your "Build Location" is the "Derived Data Location".

I can push changes that rsync the headers to a known location, but I was hoping that standardizing on DerivedData would simplify the process.

Community
  • 1
  • 1
Blake Watters
  • 6,607
  • 1
  • 43
  • 33
  • Yes I followed the instructions on the wiki and set the build location to `DerivedData directory` but still no luck. I've updated my question. +1 for a useful answer however. – Richard Stelling Nov 29 '11 at 09:38
  • I've just pushed an update to the project on the 402 branch that will rsync the Header files into Build/RestKit. This should let you add an explicit header path. Give that a try and advise. – Blake Watters Nov 30 '11 at 02:56
  • Yes, that fixes the Example building+archiving issues but still can't build+archiving a static lib project of my own, same error but the settings are the same. I will have a play but is there anything different about a building a lib that includes RestKit that might cause this issue? – Richard Stelling Nov 30 '11 at 10:56
  • You are trying to build a static library that contains RestKit? You really don't want to do that -- trying to link one static library into another does not work. You'll need to pull the RestKit sources themselves into the project rather than using a dependency and linking the static lib in. – Blake Watters Dec 01 '11 at 01:40
1

Just add "$(SOURCE_ROOT)/RestKit/Build" to you target "Header Search Paths", Thanks to this answer.

Community
  • 1
  • 1
Muhammad Hassan Nasr
  • 2,718
  • 3
  • 18
  • 20
1

I'm sure some of these are redundant, but I just spent over 3 hours debugging this thing and almost ruined my project in the process. So... Here you have it.

For the sake of your sanity, create a zip backup of your project before messing with RestKit project paths, commit all files (especially the project) to source control, cross your fingers, burn a virgin hair over your mac, then proceed.

After eliminating them one by one, I narrowed it down to this line allowing me to archive. "$(SOURCE_ROOT)/../RestKit/Build" Restkit is a folder at the same level as the main project folder

solution

Alex Stone
  • 46,408
  • 55
  • 231
  • 407
1

To reiterate Jamie Reynolds answer, most (if not all) of you have set your header search paths to "$(SOURCE_ROOT)/RestKit/Build", this is fine while debugging and also fine for archiving, unless of course your Restkit framework IS actually in this directory.

Like the majority of you out there, you have probably just linked to the framework from the default download directory, in which case go to finder, open Restkit->Build cmd+i to see the info and select the directory path, copy and replace "$(SOURCE_ROOT)/RestKit/Build", dont forget the brackets.

mine was "/Users/edwin-b/Downloads/RestKit-RestKit-8d0d9fc/Build" worked like a charm

Edwin
  • 3,812
  • 2
  • 21
  • 16
1

I followed the steps outlined in several SO answers, and the issue ended up being a problem with the Header Search Paths. Sometime between adding RestKit in XCode 4.2 and trying to archive in XCode 4.3.1 (I had updated twice between starting the project and providing a build), a comma had been injected in the Header Search Path list which Xcode could no longer parse. As a result, the entry for RestKit's header location was:

"$(SOURCE_ROOT)/RestKit/Build", 

When it should have just been:

"$(SOURCE_ROOT)/RestKit/Build"

While this didn't produce any issues building to device or sim, once I tried to archive, it caused the error reported by the OP.

ashack
  • 1,192
  • 11
  • 17
0

I'm adding this answer so I can find it later - it matches some responses above. Look in your targets "Header Search Paths" - and depending on where your restkit directory is in your project, add one of the lines specified above in Alex Stones answer. In my case, it was "$(SOURCE_ROOT)/../RestKit/Build"

Jack BeNimble
  • 35,733
  • 41
  • 130
  • 213