2017-10-11 34 views
0

应用越来越崩溃与以下日志(PFA)及其iOS中只得到11坠毁自动版式:NSInternalInconsistencyException与iOS11

致命异常:NSInternalInconsistencyException,不可能设置 了布局视图层次毫无准备的约束。

__120- [UIView的(UIConstraintBasedLayout)_layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] _ block_invoke_2

enter image description here

更新: -

方案: - 我有一个UIToolbar在键盘上,添加代码

视图层次结构为n NSLayoutConstraint:0x1c0295540五:OT用于约束制备UIToolbar:0x10219f550] - (O) - [_ UIRemoteKeyboardPlaceholderV IEW:0x10219fab0](不活动)

#pragma mark KeyBoard Related Function 
-(void)createInputAccessoryView:(NSInteger)tagNumber 
{ 
    inputAccessoryView = [[UIToolbar alloc]init]; 
    [inputAccessoryView setBackgroundColor:kKYBOARDCOLOR]; 
    [inputAccessoryView sizeToFit]; 
    [inputAccessoryView setHidden:NO]; 

    //Use this to put space in between your toolbox buttons 

    UIBarButtonItem *barSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace 
                       target:nil 
                       action:nil]; 

    UIBarButtonItem *barBtnDone = [[UIBarButtonItem alloc] initWithTitle:@"Done" 
                    style:UIBarButtonItemStyleDone 
                    target:self action:@selector(actnResignKeyboard)]; 
    NSArray *barItems; 
    barItems = [NSArray arrayWithObjects:barSpace,barBtnDone, nil]; 
    [inputAccessoryView setItems:barItems animated:YES]; 

} 

出现和消失键盘导致碰撞,但如果我移除UIToolbar,那么每件事情都很好。

注: - 此代码工作正常之前,iOS的11

+0

您可以确定哪些约束(或至少哪个视图)导致此问题 –

+0

如果您尝试为尚未添加的视图布局约束,则会发生此错误查看heirarchy。 –

+0

@MilanNosáľ请现在看看 –

回答

0

你尝试打印堆栈跟踪了解哪些布局或视图层次原因造成的?也可以尝试首先将视图添加到超级视图然后应用约束