xcode 尝试使用主线程时 DispatchQueue 的歧义使用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39644492/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:19:52 来源:igfitidea点击:
Ambiguous use of DispatchQueue on trying to use main thread
提问by Jonathan Bursztyn
回答by Rashwan L
Try this code instead, this is the Swift 3.0 syntax:
试试这个代码,这是 Swift 3.0 语法:
DispatchQueue.main.async(execute: { () -> Void in
})
For Swift 4.x you can also use:
对于 Swift 4.x,您还可以使用:
DispatchQueue.main.async {
}