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

ios – swift 3中的dispatchqueue显示为未解析的标识符,第1张

概述参见英文答案 > Swift 3.0 unresolved identifier for DispatchQueue                                    2个 我试图在主线程上异步拍摄/录制视频.但是,当我调用dispatch.main.async时,我总是收到错误: use of unresolved identifier DispatchQueue 从WWDC 参见英文答案 > Swift 3.0 unresolved identifier for DispatchQueue2个
我试图在主线程上异步拍摄/录制视频.但是,当我调用dispatch.main.async时,我总是收到错误:
use of unresolved IDentifIEr dispatchQueue

从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: nil)                                }                            })                        }                    }                })            }        }        else {            self.cameraEngine.stopRecordingVIDeo()        }    }
解决方法@H_403_13@ 你可以放
import Foundation

要么

import dispatch

在代码的开头,开始使用dispatchQueue类没有任何问题.

总结

以上是内存溢出为你收集整理的ios – swift 3中的dispatchqueue显示为未解析标识符全部内容,希望文章能够帮你解决ios – swift 3中的dispatchqueue显示为未解析的标识符所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1100104.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存