小编Nig*_*k95的帖子

swift 3中的dispatchqueue显示为未解析的标识符

我试图在主线程上异步拍摄/录制视频.但是,当我打电话时dispatch.main.async,我总是得到错误:

use of unresolved identifier DispatchQueue
Run Code Online (Sandbox Code Playgroud)

从WWDC到Apple的文档我到处都是,但我看不到这种类型被弃用的证据.

这是代码:

   if !self.cameraEngine.isRecording {
            if let url = CameraEngineFileManager.temporaryPath("video.mp4") {
                self.cameraButton.setTitle("stop recording", forState: [])
                self.cameraEngine.startRecordingVideo(url, blockCompletion: { (url: NSURL?, error: NSError?) -> (Void) in
                    if let url = url {

                        DispatchQueue.main.async {
                            self.cameraButton.setTitle("start recording", for: .normal)
                            CameraEngineFileManager.saveVideo(url, blockCompletion: { (success: Bool, error: Error?) -> (Void) in
                                if success {
                                    let alertController =  UIAlertController(title: "Success, video saved !", message: nil, preferredStyle: .alert)
                                    alertController.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
                                    self.present(alertController, animated: true, completion: …
Run Code Online (Sandbox Code Playgroud)

grand-central-dispatch ios swift3

7
推荐指数
2
解决办法
4601
查看次数

标签 统计

grand-central-dispatch ×1

ios ×1

swift3 ×1