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

前端 未结 14 1961
暗喜
暗喜 2021-01-17 07:49

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 Xc

相关标签:
14条回答
  • 2021-01-17 08:17

    After spending 2 days on this same error and navigating to every possibile google result I finally got it!

    It's not due to Derived Data settings, those are fine already in XCode 4.3.2.

    The problem is that you are doing a #import "RKObjectMapping.h" or some other include.

    Instead use @class RKObjectMapping or if you really nead the .h use <RestKit/RKObjectMapping.h>

    I went with @class since I just need to compile...

    Hope this help!

    0 讨论(0)
  • 2021-01-17 08:18

    Here's a common mistake that'll make you want to slap yourself after you fix it.

    Yes, you definitely do want to add "$(BUILT_PRODUCTS_DIR)/../../Headers" to your target's Header Search Paths, but don't forget to include the quotes!

    I'm talking about the quotes that are before $(BUILT and after _DIR)/../../Headers

    If your build configuration has a space in the name (e.g. mine is 'Ad Hoc') and you've just added $(BUILT_PRODUCTS_DIR)/../../Headers without the leading and trailing quotes, you may end up getting the "Lexical or Preprocessor issue: RestKit/RestKit.h file not found" problem.

    0 讨论(0)
  • 2021-01-17 08:19

    I found that I 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
    0 讨论(0)
  • 2021-01-17 08:22

    This is a problem that I don't think has enough answers for this problem, because if you have this problem it feels like there is nothing to be done! After trying all of the proposed solutions (none of them worked). I finally found the problem

    The problem was that one of my folders had a space in it. Don't use spaces in your source folder names!

    Used to be : (/Xcode projects/basicRestkit etc...)  -- lots of pain and suffering  
    changed to : (/projects/basicRestkit) -- lots of rejoicing
    

    This caused the header search paths not to work, and therefore not to find the files. There may very well be a way to use alter the header search paths to find your files even with spaces.

    This might not help you, but it very well could. Good luck.

    0 讨论(0)
  • 2021-01-17 08:23

    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.

    0 讨论(0)
  • 2021-01-17 08:25

    Had a very similar problem. It turned out to be I had accidentally added the build setting to "User Header Search Paths" rather than "Header Search Paths".

    0 讨论(0)
提交回复
热议问题