Ios WebRTC[UIView renderFrame:]:发送到实例的选择器无法识别

Ios WebRTC[UIView renderFrame:]:发送到实例的选择器无法识别,ios,swift,webrtc,Ios,Swift,Webrtc,我已经在我的应用程序中安装了用于音频/视频通话的pod“WebRTC”。在故事板中,我有两个类为“RTCDeorenderer”的UIView。下面是我的代码。我在跟踪 这是由于错误导致的崩溃: 主线程检查器:在后台线程上调用的UI API:-[UIView setSize:] PID:9951,TID:2583661,线程名称:(无),队列名称:com.apple.avfoundation.videodataoutput.bufferqueue,QoS:0 [UIView renderFram

我已经在我的应用程序中安装了用于音频/视频通话的pod“WebRTC”。在故事板中,我有两个类为“RTCDeorenderer”的UIView。下面是我的代码。我在跟踪

这是由于错误导致的崩溃:

主线程检查器:在后台线程上调用的UI API:-[UIView setSize:] PID:9951,TID:2583661,线程名称:(无),队列名称:com.apple.avfoundation.videodataoutput.bufferqueue,QoS:0

[UIView renderFrame:]:发送到实例0x101501840的选择器无法识别 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[UIView renderFrame:]:无法识别的选择器已发送到实例0x101501840”


尝试在主线程中调用函数。dispatch.mainI已在主线程上调用configureClient()方法。但还是一样。还有其他的方法吗?请阅读这篇文章。您可能会更好地理解如何在主线程中调用函数@Tarandel是的,我用同样的方法调用。尝试在主线程中调用函数。dispatch.mainI已在主线程上调用configureClient()方法。但还是一样。还有其他的方法吗?请阅读这篇文章。您可能会更好地理解如何在主线程中调用函数@塔拉坦德尔:是的,我也是这么叫的。
func configureClient() {
    let iceServers = RTCIceServer.init(urlStrings: [stunServer])
    let client = RTCClient.init(iceServers: [iceServers], videoCall: true)
    client.delegate = self
    self.client = client
    client.startConnection()
}

extension ViewController: RTCClientDelegate {
func rtcClient(client: RTCClient, didCreateLocalCapturer capturer: RTCCameraVideoCapturer) {
    let settingsModel = RTCCapturerSettingsModel()
    self.captureController = RTCCapturer.init(withCapturer: capturer, settingsModel: settingsModel)
    captureController.startCapture()
}

func rtcClient(client: RTCClient, didGenerateIceCandidate iceCandidate: RTCIceCandidate) {
    print("iceCandidate generated")
}

func rtcClient(client: RTCClient, didReceiveLocalVideoTrack localVideoTrack: RTCVideoTrack) {
    DispatchQueue.main.async {
        localVideoTrack.add(self.localVideoView)
        self.localVideoTrack = localVideoTrack
    }
}

func rtcClient(client: RTCClient, startCallWithSdp sdp: String) {
    print("SDP generated")
}

func rtcClient(client: RTCClient, didReceiveRemoteVideoTrack remoteVideoTrack: RTCVideoTrack) {
    DispatchQueue.main.async {
        remoteVideoTrack.add(self.remoteVideoView)
        self.remoteVideoTrack = remoteVideoTrack
    }
}

func rtcClient(client : RTCClient, didReceiveError error: Error) {
    print("Error Received: \(error)")
}
}