我正在尝试导入libjingle_peerconnection
框架到我的 Xcode 项目中,但由于某种原因,我无法使用以下命令导入 Objective-C 标头import RTCICEServer
在 Swift 源文件中。我尝试使用头文件等。我做错了什么?
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'VideoRTCTest' do
pod "libjingle_peerconnection"
end
target 'VideoRTCTestTests' do
end
target 'VideoRTCTestUITests' do
end
Bridge
1. 创建 xxx-Bridging-Header
使用您选择的方法将桥接标头添加到您的项目中,最简单的方法是创建一个.m
归档并答复创建桥接头到这个对话框:
2. 在桥接标头中引用您的 Pod
包括您的文件,如下所示:
//
// Use this file to import your target's public headers that
// you would like to expose to Swift.
#import "RTCICEServer.h"
3. Objective-C 暴露给 Swift
一旦进入桥接头文件,您就不需要在 Swift 中导入 Obj-C 类。直接使用这些:
let uri = URL(fileURLWithPath: "")
let rtc:RTCICEServer = RTCICEServer(uri: uri, username: "", password: "")
print(rtc)
另一个例子描述here https://stackoverflow.com/a/31641508/218152.
► 在以下位置找到此解决方案GitHub https://github.com/SwiftArchitect/SO-34553684以及其他详细信息快速食谱 http://swiftarchitect.com/recipes/#SO-34553684.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)