When I attempt to import the RestKit api into a project I get the following error:
/Documents/Code/RestTest/RestKit/Code/Network/RKHTTPRequestOperation.h:21:9:
'AFNetworking.h' file not found
I have installed RestKit as a git submodule, how do I resolve RestKit's dependency on AFNetworking?
Once cloned, simply do in the RestKit directory:
git submodule update --init --recursive
This will pull the AFNetworking version RestKit needs
If you use CocoaPods will do all this automaticaly.
From RestKit install docs:
Install CocoaPods if not already available:
$ [sudo] gem install cocoapods
$ pod setup
Edit your Podfile and add RestKit:
$ edit Podfile
platform :ios, '5.0'
pod 'RestKit', :git => 'https://github.com/RestKit/RestKit.git', :branch => 'development'
Testing and Search are optional components
pod 'RestKit/Testing', :git => 'https://github.com/RestKit/RestKit.git', :branch => 'development'
pod 'RestKit/Search', :git => 'https://github.com/RestKit/RestKit.git', :branch => 'development'
Install into your project:
$ pod install
Please note that if your installation fails, it may be because you are installing with a version of Git lower than CocoaPods is expecting. Please ensure that you are running Git >= 1.8.0 by executing git --version. You can get a full picture of the installation details by executing pod install --verbose.
This might help some people. I completely skipped this section in the RestKit wiki specifically aimed at avoiding AFNetworking errors:
https://github.com/RestKit/RestKit/wiki/Installing-RestKit-v0.20.x-as-a-Git-Submodule#updating-the-precompiled-header-file
I had an 'AFNetworking.h' file not found
error and it was because I missed these imports in the .pch.