【发布时间】:2020-10-18 18:48:40
【问题描述】:
请原谅我的 Swift 菜鸟。
我正在使用 Twilio 的 VideoCall 框架,想知道为什么我的 RoomDelegate 函数没有被调用。
在我看来,我有一个 RoomDelegate 实例
struct AppHome: View {
var roomDelegate = myRoomDelegate()
当我连接到一个房间时,我传入了我的 roomDelegate:
let connectOptions = ConnectOptions(token: self.accessToken) { (builder) in
builder.roomName = self.call.call_api.room_name
builder.audioTracks = [self.roomDelegate.localAudioTrack!]
}
let room = TwilioVideoSDK.connect(options: connectOptions, delegate: self.roomDelegate)
我的 roomDelegate 类有:
class myRoomDelegate: NSObject, RoomDelegate {
...
func roomDidConnect(room: Room) {
print("Delegate " + #function)
}
func roomDidDisconnect(room: Room, error: Error?) {
print("Delegate " + #function)
}
func roomDidFailToConnect(room: Room, error: Error) {
print("Delegate " + #function)
}
func roomIsReconnecting(room: Room, error: Error) {
print("Delegate " + #function)
}
func roomDidReconnect(room: Room) {
print("Delegate " + #function)
}
func participantDidConnect(room: Room, participant: RemoteParticipant) {
print("Delegate " + #function)
}
func participantDidDisconnect(room: Room, participant: RemoteParticipant) {
print("Delegate " + #function)
}
}
我发现的所有委托示例都使用self,所以我试图了解我所做的是否有效,如果是,为什么我的委托回调没有受到影响?
【问题讨论】:
标签: ios swift delegates twilio