I get this log in the console when I am running my application in is simulator. Haven't seen this in iOS 8. I am not quite sure whats causing this. Has anyone else come across the same issue and if so how was it fixed? or is there any help anyone can provide in regards to this?
本文主要是介绍IOS9输出UIK的提示存在崩溃问题的风险,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
最近做项目升级了Xcode到7.1.1,突然出现了这个问题,而且容易导致程序崩溃,经过查询顺利解决,记录如下;
1:问题: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.
2:只需要把UI的崩溃的部分添加到dispatch_async(dispatch_get_main_queue(), ^(void){ <code> });内部即可;
相关资料如下:
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes
up vote 9 down vote favorite 4 | iphone ios9 xcode7-beta4 | ||
add a comment |
1 Answer
up vote 19 down vote | Do not change UI from anything but the main thread. While it may appear to work on some OS or devices and not others, it is bound to make your application unstable, and crash unpredictably. If you must respond to a notification, which can happen in the background, then ensure You at least have these 2 options: Asynchronous Dispatch Use When to use Listen on Main Thread Conveniently, you can specify on which thread you want the observer to be notified, at the time you are registering for notifications, using the When to observe on main thread? When you are both registering and registered. Bu the time you respond to the notification, you are already where you need to be. Post Notification On Main Thread Hybrid solution which does not guarantee that the observer is only invoked from said method. It allows for lighter observer, at the cost less robust design. Only mentioned here as a solution you should probably avoid. | ||||||||||||||||||||
|
这篇关于IOS9输出UIK的提示存在崩溃问题的风险的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!