Nested optimization should never be triggered. This is probably due to autolayout work happening inside an NSISVariable delegate callback

拈花ヽ惹草 提交于 2019-12-12 13:32:51

问题


App crashed and log gave me this message:

"Nested optimization should never be triggered. This is probably due to autolayout work happening inside an NSISVariable delegate callback, which is not allowed."

How to fix this?


回答1:


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.

Example:

if ([NSThread isMainThread]) { NSLog(@"isMainThread"); } else { NSLog(@"isNotMainThread"); }
_MyLbl.text=@"some text";

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.



来源:https://stackoverflow.com/questions/44318195/nested-optimization-should-never-be-triggered-this-is-probably-due-to-autolayou

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!