Cocoapods 1.0:头文件未找到

时间:2023-01-13 20:32:32

I just tried to update from cocoapods 0.39.x to Cocoapods 1.0. Running

我只是想从可可粉中更新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?

我显式地在头搜索路径、用户头搜索路径和框架搜索路径中包含$(继承),但是错误不会消失。有人知道怎么解决这个问题吗?

2 个解决方案

#1


30  

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 *.

错误消息非常容易引起误解。一开始我认为我的头搜索路径有一些问题,所以我基本上尝试了我在*上找到的所有东西。

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 !在您的播客文件中,您不必在桥接头中包含每个Objective-C pod。您只需要这样做,如果pod作为静态库而不是作为框架分发的话。

I did the following

我做了以下

  1. Press Cmd + option + shift + k to clean your build folder
  2. 按Cmd +选项+ shift + k来清理你的构建文件夹
  3. Run pod install
  4. 运行舱安装
  5. 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
  6. 删除桥接头中的行,它告诉您没有找到头文件,并在您想在一个特定的Swift文件中使用该模块时使用一个简单的导入语句,例如,导入AFNetworking

#2


3  

I tried remove ~/Library/Developer/Xcode/DerivedData/* and rebuild the project, and it worked for me.

我尝试删除~/Library/Developer/Xcode/DerivedData/*并重新构建项目,它对我很有效。

#1


30  

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 *.

错误消息非常容易引起误解。一开始我认为我的头搜索路径有一些问题,所以我基本上尝试了我在*上找到的所有东西。

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 !在您的播客文件中,您不必在桥接头中包含每个Objective-C pod。您只需要这样做,如果pod作为静态库而不是作为框架分发的话。

I did the following

我做了以下

  1. Press Cmd + option + shift + k to clean your build folder
  2. 按Cmd +选项+ shift + k来清理你的构建文件夹
  3. Run pod install
  4. 运行舱安装
  5. 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
  6. 删除桥接头中的行,它告诉您没有找到头文件,并在您想在一个特定的Swift文件中使用该模块时使用一个简单的导入语句,例如,导入AFNetworking

#2


3  

I tried remove ~/Library/Developer/Xcode/DerivedData/* and rebuild the project, and it worked for me.

我尝试删除~/Library/Developer/Xcode/DerivedData/*并重新构建项目,它对我很有效。