我按照本教程使用 Swift 创建了一个 Vidyo iOS 应用程序。
但是我在以下方面遇到应用程序崩溃:
connector = VCConnector(UnsafeMutableRawPointer(&vidyoView),
viewStyle: .default,
remoteParticipants: 4,
logFileFilter: UnsafePointer("warning"),
logFileName: UnsafePointer(""),
userData: 0)
以下是调试器日志:
错误: Lmi文件: [系统线程]:/tmp/SDK.Release.TRINITY_4_1_20_3.build.tO3KysfAv5/source/SDK/Lmi/Os/LmiFile.c:132: LmiFileOpen_:打开文件 v\217\206 时出错:不允许操作
Assertion failed: (newVal>= 0(, function LmiSharedPtrRefCountDecUseCount, file/tmp/SDK.Release.TRINITY_4_1_20_3.build.tO3KysfAv5/source/SDK/Lmi/VidyoClient/../../../SDK/Lmi/Os/LmiSharedPtrInline.h, line 51.
谁能帮忙?
教程是错误的。传入logFileFilter:
和logFileName:
作为常规 Swift 字符串。
connector = VCConnector(UnsafeMutableRawPointer(&vidyoView),
viewStyle: .default,
remoteParticipants: 4,
logFileFilter: "warning",
logFileName: "",
userData: 0)
logFileFilter:
和 logFileName:
的参数类型为 const char*
。您可以将 String 传递给此类型的参数,它将为您转换。
源:将字符串传递给常量字符* 参数
您应该能够将字符串直接传递给需要常量字符 * 的 C 函数,它将自动转换为以 null 结尾的 UTF-8 字符串
请确保在创建连接器之前初始化包:
// Initialize package
VCConnectorPkg.vcInitialize()
// Create connector
connector = VCConnector(UnsafeMutableRawPointer(&vidyoView),
viewStyle: .default,
remoteParticipants: 4,
logFileFilter: "warning",
logFileName: "",
userData: 0)
这为我解决了问题。祝你好运!