项目中遇到一个跳转问题,延时(等待时间)特别久,并且报下面的的提示警告
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
问题原因:
问题的原因是因为在子线程中刷新了UI,解决办法是,回到主线程中刷新UI
解决办法:
参考:CocoaChina
dispatch_async(dispatch_get_main_queue(), ^
{
// 更UI
});
或者
[self performSelectorOnMainThread:<#(nonnull SEL)#> withObject:<#(nullable id)#> waitUntilDone:<#(BOOL)#>]
本文解决了iOS开发中UI线程更新导致的延迟和警告问题,通过将UI更新操作转移至主线程,避免了可能产生的应用程序崩溃风险。

591

被折叠的 条评论
为什么被折叠?



