Mic*_*iot 2 cocoapods swift objc-bridging-header
这里是新开发人员,我目前正在快速构建一个应用程序。我们正在使用 cocoapods,但运行 pod install 后,我们在 Objective-C 桥接标头中收到错误消息,指出无法找到该文件,但对于桥接标头中的所有文件而言。例如,我们使用DateTools。我们 pod 安装它,在我们放置的桥接标头中:
#import <DateTools/DateTools.h>
但是,在运行时,它出错,说'Datetools/Datetools.h' file not found. 我已经浏览了很多其他类似的帖子(例如this、this或this),但没有一个能够解决问题。任何帮助将不胜感激!
当使用use_frameworks! 根据 Cocoapods 中的指令,在 Swift 中导入 Objective-C pod 不需要桥接标头。
只需将所需的 pod 设置到 podfile 中即可:
#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
Run Code Online (Sandbox Code Playgroud)
跑步pod install。运行pod update(应该不是必需的,但由于某种原因,我几乎每次都会收到更新,即使是在全新安装之后)。关闭 Xcode 并使用白色xcworkspace文件重新打开。
import Alamofire
import ActiveLabel
import IDMPhotoBrowser
import Firebase
Run Code Online (Sandbox Code Playgroud)
完毕。
| 归档时间: |
|
| 查看次数: |
2042 次 |
| 最近记录: |