为什么这段代码会导致崩溃?
我们为什么要这样写:-
DispatchQueue.main.sync {
// Operation To Perform
}
我们为什么要这样写:-
DispatchQueue.global().async(execute: {
print("test")
DispatchQueue.main.sync{
print("main thread")
}
})
当我们在CellForRowAt或其他方法中编写代码时,它是在主线程还是全局线程上运行?它是同步方式还是异步方式?