Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RestKit/RestKit.h file not found error - version 0.10.0

I am losing my hair in my attempts to get RestKit to build and work. I get the dreaded "Lexical or Preprocessor issue: RestKit/RestKit.h file not found" message. I use Xcode 4.2 & my project is for iOS.

Earlier, I had debug mode working perfectly with RestKit 0.9.0. Then I ran into issues while trying to archive. After reading this forum and attempting some solutions, I decided to upgrade to 0.10.0 with hopes that it will solve the issue.

Now, my project is not even building in debug mode and I get the same RestKit/RestKit.h file not found error.

I have this under Header search path: "$(BUILT_PRODUCTS_DIR)/../../Headers". Can you please suggest (for 0.10.0 version): 1) Where should the physical location of RestKit be? (It may not matter, but which one worked for you - with hopes that I can mirror your setting) 2) I tried to point my header search path to "/Developer/Library/RestKit-RestKit-69adee9/" and later to "/Developer/Library/RestKit-RestKit-69adee9/Build"

Throughly confused and frustrated..

EDIT1: After several hours, I gave up. Nuked my project. Created a fresh project. Re-created the files (copy paste from prev project). Now "RestKit not found" error is gone! But now, I am getting this other error:

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_RKObjectMapping", referenced from:
objc-class-ref in myclassname1.o
"_OBJC_CLASS_$_RKObjectManager", referenced from:
objc-class-ref in myclassname2.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I checked & made sure that I did NOT add RestKit.framework... I've no idea why the clang error is happening now

EDIT2: The libRestKit.a was red. It is OK according to https://github.com/RestKit/RestKit/wiki/Installation-Troubleshooting Just for the heck of it, I removed all the linked dependencies. Removed the "Other linker flags". Closed & reopened Xcode. Put them all back. That error is gone. Maybe I missed a framework which resulted in clang error. But it is highly unlikely for I checked & double checked. It works now.

It builds & archives on debug mode. I haven't tried the distribution mode yet.

EDIT3: Apple approved my app in the first go & it is live! I still do not know what caused the issue here. Nuking an existing project & creating a new one & copying over the old files (& periodically checking if build goes through) cannot be a solution. So I am leaving this question open.

like image 706
Ravi Avatar asked Apr 16 '12 04:04

Ravi


2 Answers

I think I can shed some light on this.

When you upgrade to 0.10.0, you change your header search paths to "$(BUILT_PRODUCTS_DIR)/../../Headers", right?

The install guide only says to do this for the project settings. However in many cases, mine included, you'll need to also update them for the target settings as well.

The target settings will still have the old header search paths, and for whatever reason decide not to inherit from the project settings.

like image 53
Evan Cordell Avatar answered Nov 18 '22 04:11

Evan Cordell


Mind you - its a total hack - but it got my project running.

Assuming that you've already followed the installation steps from the RestKit Github https://github.com/RestKit/RestKit/blob/master/README.md#quick-start-aka-tldr

In the RestKit target, goto Build Phases. Under the Copy Headers dropdown, move all of the header files from "Project" to "Public".

Clean, Build, Run.

like image 3
Chris Dutra Avatar answered Nov 18 '22 03:11

Chris Dutra