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.
我正在制作一个iOS应用程序,我有这个在线程中运行的方法,我也在这个方法中调用另一个方法,但是在执行第二种方法时,应用程序崩溃了,实际上,我想移动到第二种方法成功执行后的新视图。
任何帮助将不胜感激。欢迎索取代码。
UI 不是线程安全的。因此,您应该只从主线程更新 UI。
要强制代码在主线程上运行,您可以在线程或其他块中使用这样的块:
dispatch_async(dispatch_get_main_queue(), ^{ // Update UI here });