Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在主线程上并尝试 DispatchQueue.main.async 时,它不会使应用程序崩溃,但 DispatchQueue.main.sync 会。为什么这样?
根据文档
sync -- 将块提交到调度队列以进行同步执行。与 dispatch_async( : :) 不同,该函数在块完成之前不会返回。调用此函数并以当前队列为目标会导致死锁
因为队列在等待自己