简体   繁体   English

iOS6上的Autolayout问题:“应该从引擎中删除所有依赖约束,也可以从视图的依赖约束列表中删除”

[英]Autolayout issue on iOS6: “All dependent constraints should have been removed from the engine and also from the view's list of dependent constraints”

Has anyone encountered this warning message related with autolayout: 有没有人遇到过与autolayout相关的警告信息:

All dependent constraints should have been removed from the engine and also from the view's list of dependent constraints

Currently, we have some footerView with several buttons inside and they are hidden or showed depending on the need. 目前,我们有一些内部有几个按钮的footerView,它们根据需要隐藏或显示。 We use full autolayout everywhere. 我们到处都使用完全自动布局。 Here's the method for hiding/showing this footerView: 这是隐藏/显示此footerView的方法:

- (void)hideFooterView:(BOOL)shouldHide {

  self.containerViewBottomConstraint.constant = shouldHide ? 0 : 50; // expand  containing view to fit to full screen OR make it smaller to fit with footerView

  [UIView animateWithDuration:1 animations:^{
    [self.view layoutIfNeeded]; // animate expanding screen height to full height
    [self.footerView setAlpha:(shouldHide ? 0 : 1)];
  } completion:nil];  
}

So, when this method is called for the first time then there's no error message. 因此,当第一次调用此方法时,则没有错误消息。 But after the second time mentioned warning appears in console. 但在第二次提到警告后出现在控制台中。 We can't ignore this warning because in other screens we are encountering crashes with private Apple method calls without any clue how to solve that: 我们不能忽略这个警告,因为在其他屏幕中我们遇到了私有Apple方法调用的崩溃,而没有任何线索如何解决这个问题:

[UILayoutContainerView nsis_shouldIntegralizeVariable:]: message sent to deallocated instance

here's another crash message: 这是另一个崩溃消息:

[UILayoutContainerView nsis_valueOfVariable:didChangeInEngine:]: message sent to deallocated instance

I was unable to find anything useful related to "nsis_valueOfVariable:didChangeInEngine:" or "Autolayout dependent constraints" keywords on web. 我无法在网上找到与“nsis_valueOfVariable:didChangeInEngine:”或“Autolayout dependent constraints”关键字相关的任何有用信息。 Any ideas? 有任何想法吗?

UPDATE Commenting out line "[self.view layoutIfNeeded]" seems fixed the issue but then there will be no animation... 更新注释掉行“[self.view layoutIfNeeded]”似乎修复了问题,但之后就没有动画......

In my project also this issue came. 在我的项目中也出现了这个问题。 I was getting same warning "All dependent constraints should have been removed from the engine and also from the view's list of dependent constraints". 我得到了相同的警告“所有依赖约束应该已从引擎中删除,也从视图的依赖约束列表中删除”。

As you told, when I ignored it and in other screens I got crashes, showing 正如你所说的那样,当我忽略它时,在其他屏幕上我出现了崩溃,显示出来

[UILayoutContainerView nsis_shouldIntegralizeVariable:]: message sent to deallocated instance

I found that, in my case I was calling [self.view layoutIfNeeded] inside -(void)viewWillDisappear:(BOOL)animated . 我发现,在我的情况下,我在调用[self.view layoutIfNeeded] -(void)viewWillDisappear:(BOOL)animated When I removed this out, the issue was fixed. 当我删除它时,问题得到解决。 No warnings and no crashes. 没有警告也没有崩溃。

From this what I understood is, if we call layoutIfNeeded just before the view is being deallocated this warning will come. 根据我的理解,如果我们在视图被解除分配之前调用layoutIfNeeded ,则会出现此警告。 And in next screens it will cause crashing. 在下一个屏幕中,它会导致崩溃。

It took so much time to figure out this crash. 花了很多时间才弄明白这次事故。 That's why I am sharing my thoughts. 这就是为什么我要分享我的想法。

This may help someone. 这可能对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM