Luc*_*son 5 crash xcode objective-c ios autolayout
应用程序崩溃了,日志给了我这条消息:
“永远不应该触发嵌套优化。这可能是由于自动布局工作发生在 NSISVariable 委托回调内,这是不允许的。”
如何解决这个问题?
认为我正在后台线程中更新 UI。尝试将:
if ([NSThread isMainThread]) { NSLog(@"isMainThread"); } else { NSLog(@"isNotMainThread"); }放在 UI 更新行旁边,以便在后台线程中查找 UI 更新。
例子:
if ([NSThread isMainThread]) { NSLog(@"isMainThread"); } else { NSLog(@"isNotMainThread"); }
_MyLbl.text=@"some text";
Run Code Online (Sandbox Code Playgroud)
如果日志中显示 isNotMainThread,请将这两行替换为:
dispatch_async(dispatch_get_main_queue(), ^{
_MyLbl.text=@"some text";
});
Run Code Online (Sandbox Code Playgroud)
并不是真正的答案,更多的是提示。但我想总比没有好。
| 归档时间: |
|
| 查看次数: |
1256 次 |
| 最近记录: |