ios - Swift 编译器错误 : Header not found

标签 ios swift header xcode6 cocoapods

我开始了一个依赖 Cocoa Pods 的“Cocoa Touch 静态项目”。

播客文件:

platform :ios, '8.4'

inhibit_all_warnings!

target 'project' do
pod 'libPusher', '~> 1.6'
end

target 'project' do

end

工作区已通过命令“pod install”创建。

然后我在这个工作区上创建了一个 swift 项目,并在这个 swift 项目和我的 Objective-C 库项目之间创建了一个 Bridge header 。

我的swift项目配置:

//:configuration = Debug
SWIFT_OBJC_BRIDGING_HEADER = demo/demo-Bridging-Header.h

//:configuration = Release
SWIFT_OBJC_BRIDGING_HEADER = demo/demo-Bridging-Header.h

当我编译我的 swift 项目时,我得到这个错误:

demo-Bridging-Header.h:5:9: In file included from /Users/XYZ/Projets/iOS/project/library/demo/demo/demo-Bridging-Header.h:5:

project.h:10:9: 'Pusher/PTPusherDelegate.h' file not found

Failed to import bridging header '/Users/XYZ/Projets/iOS/project/project/demo/demo/demo-Bridging-Header.h'

您知道为什么 swift 编译器找不到头文件吗?我该如何解决?

最佳答案

• 您是否运行了pod install

Installing SocketRocket (0.3.1-beta2)

Installing libPusher (1.6)

• Did you open demo.xcworkspace(关闭Xcode项目,打开Xcode工作区)

如果是这样,则为正确的demo-Bridging-Header.h内容:

#import "Pusher.h"
#import "Pusher/PTPusherDelegate.h"

关于ios - Swift 编译器错误 : Header not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31650346/

相关文章:

ios - 过度拥挤的标签在饼图和条形图中不可读

c# - 为 C# asp.net 电子商务网站构建用于移动应用程序(Android 和 iOS)的 REST API

swift - 确定 Collection View 单元格的大小

php - 让用户下载 XML 文件

c++ - 循环依赖——(如何让struct A引用struct B,struct B引用struct A)

ios - 如何在 Swift 中从 JSON 解析值大于 2147483647 的 Int

iphone - 从其他 NSString 的某个点创建 NSString

ios - 值类型未桥接到 Objective-C 错误 - 使用 SKProductsRequest 时出现运行时错误

ios - adjustsFontSizeToFitWidth 在 iOS 14 上与 NSMutableAttributedString 无法正常工作

html - 内容覆盖 header