【发布时间】:2018-10-17 01:22:05
【问题描述】:
当我们使用production key & secrets 时,我们正在使用 sinch 拨打电话但收到错误:由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“客户端未启动”。
我们在沙盒环境中成功测试,而不是因为生产应用程序凭据导致应用程序崩溃。
由于崩溃,Apple 拒绝了我们的应用
【问题讨论】:
当我们使用production key & secrets 时,我们正在使用 sinch 拨打电话但收到错误:由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“客户端未启动”。
我们在沙盒环境中成功测试,而不是因为生产应用程序凭据导致应用程序崩溃。
由于崩溃,Apple 拒绝了我们的应用
【问题讨论】:
如错误所述,这是因为客户端尚未成功启动。
您要么在收到clientDidStart 之前尝试拨打电话,要么您正在收到clientDidFail:client error:error,在这种情况下出现问题,error 应该包含有关问题的更多信息。
【讨论】:
@frals 的回答是对的。
我只是用代码扩展它。
class SinchCallViewController: UIViewController {
var sinClient: SINClient!
override func viewDidLoad() {
super.viewDidLoad()
sinClient = Sinch.client(withApplicationKey: "your key", applicationSecret: "Your secret key", environmentHost: "clientapi.sinch.com", userId: "your user id")
sinClient.delegate = self
sinClient.setSupportCalling(true)
sinClient.start()
}
}
extension SinchCallViewController: SINClientDelegate {
func clientDidStart(_ client: SINClient!) {
makeTheCall()
}
func clientDidFail(_ client: SINClient!, error: Error!) {
print("error error-->\(error)")
}
}
【讨论】: