我想在我的应用程序中构建视频通话功能,因此我决定选择Sinch框架。但是当我按通话时,似乎localView
无法跟踪。请帮助我解决此问题。非常感谢。这是我的代码获取错误:
func videoController() -> SINVideoController {
let appDel = UIApplication.shared.delegate as! AppDelegate
return (appDel.client?.videoController())!
}
我在return
行中收到此错误:
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x102bcc740)
这是我的代码:
override func viewDidLoad() {
super.viewDidLoad()
sinCall?.delegate = self
playSound()
if sinCall?.direction == SINCallDirection.incoming {
lbReceiverName.text = "Đang gọi"
_ = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateLabelForReceiver), userInfo: nil, repeats: true)
if let id = senderName {
databaseRefenrence.child("Users").child("\(id)").observeSingleEvent(of: .value, with: { (snapshot) in
if let dict = snapshot.value as? [String : Any] {
self.lbDangGoi.text = dict["Name"] as? String
}
})
}
localView.isHidden = false
btAccept.isHidden = false
btDecline.isHidden = false
btEnd.isHidden = true
} else {
_ = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateLabelForSender), userInfo: nil, repeats: true)
if let name = receiverName {
lbReceiverName.text = name
}
localView.isHidden = false
btAccept.isHidden = true
btDecline.isHidden = true
btEnd.isHidden = false
}
if sinCall?.details.isVideoOffered == true {
localView.addSubview((videoController().localView())!)
}
}
func callDidAddVideoTrack(_ call: SINCall!) {
remoteView.addSubview((videoController().remoteView())!)
}