绝不应该触发嵌套优化.这可能是由于在NSISVariable委托回调内部发生的自动布局工作 [英] Nested optimization should never be triggered. This is probably due to autolayout work happening inside an NSISVariable delegate callback
问题描述
应用程序崩溃,日志向我显示了此消息:
App crashed and log gave me this message:
绝不应该触发嵌套优化.这可能是由于在NSISVariable委托回调中发生了自动布局工作,这是不允许的."
"Nested optimization should never be triggered. This is probably due to autolayout work happening inside an NSISVariable delegate callback, which is not allowed."
该如何解决?
推荐答案
认为我正在后台线程中更新UI.尝试放入:
UI更新行旁边的if ([NSThread isMainThread]) { NSLog(@"isMainThread"); } else { NSLog(@"isNotMainThread"); }
,以便在后台线程中找到UI更新.
Think I was updating UI in a background thread. Try putting:
if ([NSThread isMainThread]) { NSLog(@"isMainThread"); } else { NSLog(@"isNotMainThread"); }
next to UI updating lines, in order to find UI updates in background thread.
示例:
if ([NSThread isMainThread]) { NSLog(@"isMainThread"); } else { NSLog(@"isNotMainThread"); }
_MyLbl.text=@"some text";
如果isNotMainThread显示在日志中,则将两行替换为:
if isNotMainThread is shown in log, replace the two lines with:
dispatch_async(dispatch_get_main_queue(), ^{
_MyLbl.text=@"some text";
});
不是一个真正的答案,更多的是提示.但我想比没有要好.
Not really an answer, more of a tip. But better than nothing I guess.
这篇关于绝不应该触发嵌套优化.这可能是由于在NSISVariable委托回调内部发生的自动布局工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!