Cocoapods 1.0:找不到头文件 [英] Cocoapods 1.0: Header files not found
问题描述
我只是尝试从cocoapods 0.39.x更新到Cocoapods 1.0。
正在运行
I just tried to update from cocoapods 0.39.x to Cocoapods 1.0. Running
pod install
pod install
<来自终端的p>没有警告。一切似乎都很正常。但是,当我尝试构建我的项目时,它会输出:
from the terminal causes no warnings. Everything seems normal. However, when I try to build my project it outputs:
找不到AFNetworking / AFNetworking.h文件
AFNetworking/AFNetworking.h file not found
我的pod文件看起来像这样(还有一些依赖项,但我只列出了它的一部分):
My pod file looks like this (there are a few more dependencies but I only listed a part of it):
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
由于某些项目是用Objective-C编写的,我创建了一个桥接标题:
Since some projects are written in Objective-C, i created a bridging header:
#import <AFNetworking/AFNetworking.h>
#import <ActionSheetPicker_3_0/ActionSheetPicker.h>
#import <SSZipArchive/SSZipArchive.h>
#import <DZNEmptyDataSet/UIScrollView+EmptyDataSet.h>
我明确包括 $(继承)
in 标题搜索路径
,用户标题搜索路径
和框架搜索路径
但错误不会消失。
有人知道如何解决这个问题吗?
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?
推荐答案
错误信息非常具有误导性。
起初我以为我的标题搜索路径有问题,所以我基本上尝试了在stackoverflow上找到的所有内容。
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.
如果你使用<你的Podfile中的code> use_frameworks!,你不必在你的桥接头中包含每个Objective-C pod。你只需要这样做,如果pod是作为静态库分发,而不是作为框架。
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.
我做了以下
- 按
Cmd
+选项
+shift
+k
清理您的构建文件夹 - 运行
pod install
- 删除桥接头中的行,它会告诉您找不到头文件,并且只要您想在一个特定的Swift文件中使用该模块,就使用简单的import语句,例如
导入AFNetworking
- 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
这篇关于Cocoapods 1.0:找不到头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!