Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 我如何检查“是否”;“请勿打扰模式”;使用Swift 4启用_Ios_Swift_Iphone - Fatal编程技术网

Ios 我如何检查“是否”;“请勿打扰模式”;使用Swift 4启用

Ios 我如何检查“是否”;“请勿打扰模式”;使用Swift 4启用,ios,swift,iphone,Ios,Swift,Iphone,我正在构建一个实时流媒体移动应用程序,需要在启动任何流媒体会话之前启用“请勿打扰模式”。如何使用Swift 4进行检查?在Obj-C中有关于这一点的答案,因此我已进行了尽职调查,并将其转换为Swift 5。希望这有助于: let update = CXCallUpdate() update.remoteHandle = CXHandle(type: .generic, value: handle) (provider as? CXProvider)?.reportNewIncomingCall(

我正在构建一个实时流媒体移动应用程序,需要在启动任何流媒体会话之前启用“请勿打扰模式”。如何使用Swift 4进行检查?

在Obj-C中有关于这一点的答案,因此我已进行了尽职调查,并将其转换为Swift 5。希望这有助于:

let update = CXCallUpdate()
update.remoteHandle = CXHandle(type: .generic, value: handle)
(provider as? CXProvider)?.reportNewIncomingCall(with: uuid, update: update) { error in
    if error != nil {
        print("error when reporting imconing: \(error?.localizedDescription ?? "")")
        (com.apple.CallKit.error.incomingcall error 3.)
        if (error as NSError?)?.code == CXErrorCodeIncomingCallError.Code.filteredByDoNotDisturb.rawValue {               
        print("Disturb mode is on!")

        }
    }
}

这回答了你的问题吗?