芒果iOS开发之This application is modifying the autolayout engine from a background thread崩溃
2016-09-02 10:44
375 查看
【主要内容:】
1. 错误提示
2. 错误写法
3. 错误原因
4. 解决问题办法
一、错误提示
今天在开发的时候遇到一个崩溃问题,“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一定要在主线程中更新。这就是导致崩溃的主要原因,写代码GCD相关的代码一定切记更新UI的操作一定要放在主线程操作。
四、解决问题办法
既然知道了要在主线程更新UI,那么只需要在原来的代码里加上这段代码:
如图:
1. 错误提示
2. 错误写法
3. 错误原因
4. 解决问题办法
一、错误提示
今天在开发的时候遇到一个崩溃问题,“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一定要在主线程中更新。这就是导致崩溃的主要原因,写代码GCD相关的代码一定切记更新UI的操作一定要放在主线程操作。
四、解决问题办法
既然知道了要在主线程更新UI,那么只需要在原来的代码里加上这段代码:
dispatch_async(dispatch_get_main_queue(), ^{ //inset code.... });
如图:
相关文章推荐
- 芒果iOS开发之This application is modifying the autolayout engine from a background thread崩溃
- iOS之崩溃处理:This application is modifying the autolayout engine from a background thread
- iOS 错误信息 This application is modifying the autolayout engine from a background thread...
- iOS - 解决This application is modifying the autolayout engine from a background thread
- iOS app运行时报错:This application is modifying the autolayout engine from a background thread after the
- 崩溃问题:iOS9 This application is modifying the autolayout engine from a background thread, which
- xcode7 ios9 处理警告 This application is modifying the autolayout engine from a background thread, which can lead to engi
- This application is modifying the autolayout engine from a background thread, which can lead to engi
- This application is modifying the autolayout engine from a background thread...
- 控制台警告“"This application is modifying the autolayout engine from a background thread, which can lead”
- This application is modifying the autolayout engine from a background thread, which can lead to engi
- This application is modifying the autolayout engine from a background thread
- This application is modifying the autolayout engine from a background thread after the engine was ac
- LGPhotoBrowser 网络请求图片 报出This application is modifying the autolayout engine from a background thread
- "This application is modifying the autolayout engine from a background thread, which can lead to en
- This application is modifying the autolayout engine from a background thread, which can lead to engi
- This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes
- This application is modifying the autolayout engine from a background thread, which can lead to engi
- This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.
- iOS9 This application is modifying the autolayout engine from a background thread, which