我在快速项目中将视频通话与语音通话集成在一起。但是问题是,在appDelegate
中,我有一个函数didReceiveIncomingCall
。如何在此函数中放置一些代码,以确定该呼叫是显示voiceCallVC
的语音呼叫还是该呼叫是显示VideoVC
的videoCall。
func client(_ client: SINCallClient!, didReceiveIncomingCall call: SINCall!) {
var top = self.window?.rootViewController
while (top?.presentedViewController != nil) {
top = top?.presentedViewController
}
let videoVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "videoVC") as! VideoCallVC
videoVC._call = call
top?.present(videoVC, animated: true, completion: nil)
let callVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "CallVC") as! VoiceCallVC
callVC._call = call
top?.present(callVC, animated: true, completion: nil)
}
答案 0 :(得分:1)
您可以检查For Bool值'call.details.isVideoOffered'
这是此代码
func client(_ client: SINCallClient!, didReceiveIncomingCall call: SINCall!) {
var top = self.window?.rootViewController
while (top?.presentedViewController != nil) {
top = top?.presentedViewController
}
if (call.details.isVideoOffered)
{
let videoVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "videoVC") as! VideoCallVC
videoVC._call = call
top?.present(videoVC, animated: true, completion: nil)
}
else{
let callVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "CallVC") as! VoiceCallVC
callVC._call = call
top?.present(callVC, animated: true, completion: nil)
}
}