RestKit和AFNetworking生成错误

当我尝试将RestKit api导入到项目中时,出现以下错误:

/Documents/Code/RestTest/RestKit/Code/Network/RKHTTPRequestOperation.h:21:9: 'AFNetworking.h' file not found 

我已经安装RestKit作为一个git子模块,我如何解决RestKit的AFNetworking的依赖?

一旦克隆,只需在RestKit目录中执行:

 git submodule update --init --recursive 

这将拉动AFNetworking版本RestKit的需要

如果你使用CocoaPods将自动完成所有这一切。

从RestKit安装文档:

如果不可用,请安装CocoaPods:

$ [sudo] gem安装cocoapods
$ pod设置

编辑您的Podfile并添加RestKit:

$编辑Podfile
平台:ios,'5.0'
pod'RestKit',:git =>'https://github.com/RestKit/RestKit.git',:branch =>'development'

testing和search是可选组件

pod'RestKit / Testing',:git =>'https://github.com/RestKit/RestKit.git',:branch =>'development'
pod'RestKit / Search',:git =>'https://github.com/RestKit/RestKit.git',:branch =>'development'

安装到您的项目中:

$ pod安装

请注意,如果安装失败,可能是因为您正在安装的Git版本低于CocoaPods所期望的版本。 请确保通过执行git –version来运行Git> = 1.8.0。 您可以通过执行pod install –verbose来获得安装详细信息的完整画面。

这可能会帮助一些人。 我完全跳过了RestKit wiki中的这个部分,专门用来避免AFNetworking错误:

https://github.com/RestKit/RestKit/wiki/Installing-RestKit-v0.20.x-as-a-Git-Submodule#updating-the-precompiled-header-file

我有一个'AFNetworking.h' file not found错误,这是因为我错过了.pch中的这些导入。