Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.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 如何将CXCallController置于前端_Ios_Swift - Fatal编程技术网

Ios 如何将CXCallController置于前端

Ios 如何将CXCallController置于前端,ios,swift,Ios,Swift,我正在创建一个VOIP应用程序。大部分逻辑与CallKit iOS Swift VoIP应用程序教程(超级简单)类似。 我的问题是,在运行viewDidLoad()之后,CXCallController不在应用程序的顶部,而是在“任务管理器”中位于其旁边: 我所关注的文档是:“如果你按下手机上的锁定按钮,你会看到呼出的电话正在尝试连接。” 在用户接受呼叫后,如何将CXCallController带到前台 import UIKit import CallKit class ViewContro

我正在创建一个VOIP应用程序。大部分逻辑与CallKit iOS Swift VoIP应用程序教程(超级简单)类似。

我的问题是,在运行viewDidLoad()之后,CXCallController不在应用程序的顶部,而是在“任务管理器”中位于其旁边:

我所关注的文档是:“如果你按下手机上的锁定按钮,你会看到呼出的电话正在尝试连接。”

在用户接受呼叫后,如何将CXCallController带到前台

import UIKit
import CallKit

class ViewController: UIViewController, CXProviderDelegate {

override func viewDidLoad() {
    let provider = CXProvider(configuration: CXProviderConfiguration(localizedName: "My App"))
    provider.setDelegate(self, queue: nil)
    let controller = CXCallController()
    let transaction = CXTransaction(action: CXStartCallAction(call: UUID(), handle: CXHandle(type: .generic, value: "Pete Za")))
    controller.request(transaction, completion: { error in })
}

    func providerDidReset(_ provider: CXProvider) {
    }

 }

对于已接受的呼叫,您不能将系统呼叫屏幕置于最前面。您必须自己提供UI。如果手机已锁定且您收到VoIP呼叫,或者如果您有1个VoIP和1个常规呼叫且您在两者之间切换,则会显示系统呼叫屏幕