当我尝试将 RestKit api 导入项目时,出现以下错误:
/Documents/Code/RestTest/RestKit/Code/Network/RKHTTPRequestOperation.h:21:9:
'AFNetworking.h' file not found
我已将 RestKit 作为 git 子模块安装,如何解决 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
这将拉取 RestKit 需要的 AFNetworking 版本
如果你使用 CocoaPods 会自动完成所有这些。
从 RestKit 安装文档:
如果 CocoaPods 不可用,请安装:
$ [sudo] gem install cocoapods
$ pod setup编辑您的 Podfile 并添加 RestKit:
$ 编辑 Podfile
平台 :ios, '5.0'
pod 'RestKit', :git => 'https://github.com/RestKit/RestKit.git', :branch => 'development'测试和搜索是可选组件
pod 'RestKit/Testing', :git => 'https://github.com/RestKit/RestKit.git', :branch => '开发'
pod 'RestKit/Search', :git => 'https:// github.com/RestKit/RestKit.git', :branch => '开发'安装到您的项目中:
$吊舱安装
请注意,如果您的安装失败,可能是因为您正在使用低于 CocoaPods 预期的 Git 版本进行安装。请通过执行 git --version 确保您正在运行 Git >= 1.8.0。您可以通过执行 pod install --verbose 来全面了解安装细节。
这可能对某些人有所帮助。我完全跳过了专门针对避免 AFNetworking 错误的 RestKit wiki 中的这一部分:
我有一个'AFNetworking.h' file not found
错误,这是因为我错过了 .pch 中的这些导入。