当前正在运行的视频通话时,应用程序会因相机或麦克风的许可而被终止或终止

时间:2018-04-06 10:14:47

标签: ios swift callkit

如果用户拒绝使用相机或麦克风,我会在收到使用自定义提醒的应用程序的电话时要求获得许可

   func showAlertForDeniedPermissions(message:String) {
    if let settingsUrl = URL(string: UIApplicationOpenSettingsURLString)  {
        let alert = UIAlertController(title: "Access Needed!", message: message, preferredStyle: UIAlertControllerStyle.alert)
        let okay = UIAlertAction(title: "OK", style: .default, handler: { (action) in
            // If camera or library settings are disabled then open general settings
            if UIApplication.shared.canOpenURL(settingsUrl) {
                UIApplication.shared.open(settingsUrl, options: [:], completionHandler: nil)
            }
        })
        alert.addAction(okay)
        self.present(alert, animated: true, completion: nil)
    }
}

如果用户点击正常,则会打开应用程序设置,并在后台呼叫将继续。 如果用户启用了摄像头或麦克风的权限,则呼叫将断开连接并再次启动应用 当我调试它显示

  Message from debugger: Terminated due to signal 9

0 个答案:

没有答案