找不到 CocoaPods 桥接 Header 文件
CocoaPods Bridging Header file not found
这里是新开发者,我目前正在 swift 中构建应用程序。我们正在使用 cocoapods,但是在 运行 pod install 之后,我们在 objective-c 桥接 header 中得到一个错误,说找不到文件,但是对于我们桥接 header。例如,我们使用 DateTools。我们 pod install 它,在桥接 header 我们放:
#import <DateTools/DateTools.h>
但是随后,在 运行 上,它出错,说 'Datetools/Datetools.h' file not found
。我已经浏览了很多其他类似的帖子(比如 this, , or ),但是 none 已经解决了这个问题。任何帮助将不胜感激!
使用时use_frameworks
! Cocoapods 中的指令,在 Swift.
中导入 Objective-C pods 不需要桥接头
只需将您想要的 pods 设置到您的播客文件中:
#Uncomment this line to define a global platform for your project
platform :ios, '9.0'
#Uncomment this line if you're using Swift
use_frameworks!
target 'YourProject' do
#Swift Pods
pod 'Alamofire'
pod 'ActiveLabel'
#ObjC Pods
pod 'IDMPhotoBrowser'
pod 'Firebase'
#This stuff is to set the SWIFT_VERSION
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
end
运行pod install
。 运行 pod update
(应该不是必需的,但出于某种原因,我几乎每次都会获得更新,即使是在全新安装之后)。关闭 Xcode 并使用白色 xcworkspace
文件重新打开。
import Alamofire
import ActiveLabel
import IDMPhotoBrowser
import Firebase
完成。
这里是新开发者,我目前正在 swift 中构建应用程序。我们正在使用 cocoapods,但是在 运行 pod install 之后,我们在 objective-c 桥接 header 中得到一个错误,说找不到文件,但是对于我们桥接 header。例如,我们使用 DateTools。我们 pod install 它,在桥接 header 我们放:
#import <DateTools/DateTools.h>
但是随后,在 运行 上,它出错,说 'Datetools/Datetools.h' file not found
。我已经浏览了很多其他类似的帖子(比如 this,
使用时use_frameworks
! Cocoapods 中的指令,在 Swift.
只需将您想要的 pods 设置到您的播客文件中:
#Uncomment this line to define a global platform for your project
platform :ios, '9.0'
#Uncomment this line if you're using Swift
use_frameworks!
target 'YourProject' do
#Swift Pods
pod 'Alamofire'
pod 'ActiveLabel'
#ObjC Pods
pod 'IDMPhotoBrowser'
pod 'Firebase'
#This stuff is to set the SWIFT_VERSION
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
end
运行pod install
。 运行 pod update
(应该不是必需的,但出于某种原因,我几乎每次都会获得更新,即使是在全新安装之后)。关闭 Xcode 并使用白色 xcworkspace
文件重新打开。
import Alamofire
import ActiveLabel
import IDMPhotoBrowser
import Firebase
完成。