ios Cocoapods 1.0:找不到头文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37377450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cocoapods 1.0: Header files not found
提问by productioncoder
I just tried to update from cocoapods 0.39.x to Cocoapods 1.0. Running
我只是尝试从 cocoapods 0.39.x 更新到 Cocoapods 1.0。跑步
pod install
吊舱安装
from the terminal causes no warnings. Everything seems normal. However, when I try to build my project it outputs:
来自终端不会引起警告。一切似乎都很正常。但是,当我尝试构建我的项目时,它会输出:
AFNetworking/AFNetworking.h file not found
未找到 AFNetworking/AFNetworking.h 文件
My pod file looks like this (there are a few more dependencies but I only listed a part of it):
我的 pod 文件看起来像这样(还有一些依赖项,但我只列出了其中的一部分):
platform :ios, '8.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
target 'MyApp' do
pod 'AFNetworking', '~> 2.6'
pod 'BEMCheckBox'
pod 'ActionSheetPicker-3.0', '~> 2.0.5'
pod 'SCLAlertView'
pod 'DZNEmptyDataSet'
pod 'SSZipArchive'
end
target 'MyAppTests' do
end
Since some projects are written in Objective-C, i created a bridging header:
由于某些项目是用 Objective-C 编写的,因此我创建了一个桥接头:
#import <AFNetworking/AFNetworking.h>
#import <ActionSheetPicker_3_0/ActionSheetPicker.h>
#import <SSZipArchive/SSZipArchive.h>
#import <DZNEmptyDataSet/UIScrollView+EmptyDataSet.h>
I explicitly included $(inherited)
in the Header Search Paths
, the User Header Search paths
, and the Framework Search paths
but the error does not go away.
Does someone have an idea on how to fix this?
我明确地包含$(inherited)
在Header Search Paths
的User Header Search paths
,而Framework Search paths
但错误没有消失。有人知道如何解决这个问题吗?
回答by productioncoder
The error message is quite misleading. At first I thought I have some problems with my header search paths, so I basically tried everything I found on stackoverflow.
错误消息非常具有误导性。起初我以为我的标题搜索路径有问题,所以我基本上尝试了我在stackoverflow上找到的所有内容。
If you use use_frameworks!
in your Podfile, you don't have to include every Objective-C pod in your bridging header.You only have to do this, if the pod is distributed as a static library, not as a framework.
如果您use_frameworks!
在 Podfile 中使用,则不必在桥接头中包含每个 Objective-C pod。如果 pod 作为静态库而不是框架分发,您只需执行此操作。
I did the following
我做了以下
- Press
Cmd
+option
+shift
+k
to clean your build folder - Run
pod install
- Delete the lines in your bridging header where it tells you that the header files are not found and use a simple import statement whenever you want to use that module in one specific Swift file, e.g.
import AFNetworking
- 按
Cmd
+option
+shift
+k
清理您的构建文件夹 - 跑
pod install
- 删除桥接头中告诉您找不到头文件的行,并在您想在一个特定的 Swift 文件中使用该模块时使用简单的导入语句,例如
import AFNetworking
回答by always_beta
I tried remove ~/Library/Developer/Xcode/DerivedData/* and rebuild the project, and it worked for me.
我尝试删除 ~/Library/Developer/Xcode/DerivedData/* 并重建项目,它对我有用。