iOS 11空白键盘和UIInputSwitcherTableCellSegmentView中的内部布局冲突

时间:2017-09-03 11:11:38

标签: ios11 xcode9

尝试将我的项目从iOS 10移植到11,整个应用程序键盘都是空白的(见图)。尝试在键盘之间切换会产生以下约束冲突:

[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. 
Try this: 
    (1) look at each constraint and try to figure out which you don't expect; 
    (2) find the code that added the unwanted constraint or constraints and fix it. 
(
"<NSLayoutConstraint:0x60c00048a460 'UISV-canvas-connection' UIStackView:0x7fee26e56210.leading == UIInputSwitcherTableCellSegmentView:0x7fee26e512a0.leading   (active)>",
"<NSLayoutConstraint:0x60c0004853c0 'UISV-canvas-connection' H:[UIInputSwitcherTableCellSegmentView:0x7fee26e57ed0]-(0)-|   (active, names: '|':UIStackView:0x7fee26e56210 )>",
"<NSLayoutConstraint:0x60c000486fe0 'UISV-fill-equally' UIInputSwitcherTableCellSegmentView:0x7fee26e56850.width == UIInputSwitcherTableCellSegmentView:0x7fee26e512a0.width   (active)>",
"<NSLayoutConstraint:0x60c000487170 'UISV-fill-equally' UIInputSwitcherTableCellSegmentView:0x7fee26e57ed0.width == UIInputSwitcherTableCellSegmentView:0x7fee26e512a0.width   (active)>",
"<NSLayoutConstraint:0x60c000486bd0 'UISV-spacing' H:[UIInputSwitcherTableCellSegmentView:0x7fee26e512a0]-(9)-[UIInputSwitcherTableCellSegmentView:0x7fee26e56850]   (active)>",
"<NSLayoutConstraint:0x60c000486f40 'UISV-spacing' H:[UIInputSwitcherTableCellSegmentView:0x7fee26e56850]-(9)-[UIInputSwitcherTableCellSegmentView:0x7fee26e57ed0]   (active)>",
"<NSLayoutConstraint:0x60c000481450 'UIView-Encapsulated-Layout-Width' UIStackView:0x7fee26e56210.width == 0   (active)>"
)

Will attempt to recover by breaking constraint 

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-09-03 12:05:00.235487+0300 ProjectName[87479:26834044] -[UIWindow endDisablingInterfaceAutorotationAnimated:] called on <UIRemoteKeyboardWindow: 0x7fee298a1000; frame = (0 0; 375 667); opaque = NO; autoresize = W+H; layer = <UIWindowLayer: 0x604000234d00>> without matching -beginDisablingInterfaceAutorotation. Ignoring.

Switching Keyboards

English Keyboard

2 个答案:

答案 0 :(得分:1)

这是由实施以下扩展时的内部iOS 11问题引起的。取下分机,键盘又回来了。

的UIView + TintColor.h

#ifndef UIView_TintColor_h
#define UIView_TintColor_h

#import <UIKit/UIKit.h>
@interface UIView (TintColor)
@property (nonatomic,retain) UIColor* tintColor;
@end
#endif /* UIView_TintColor_h */

的UIView + TintColor.m

#import <Foundation/Foundation.h>
#import "UIView+TintColor.h"
#import <objc/runtime.h>

static char const * const tintColorKey = "tintColorKey";

@implementation UIView (TintColor)

-(UIColor*)tintColor
{
    return  objc_getAssociatedObject(self , tintColorKey);
}

-(void)setTintColor:(UIColor *)tintColor
{
    objc_setAssociatedObject(self, tintColorKey, tintColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

@end

答案 1 :(得分:0)

如果其他人对此有疑问,则似乎是键盘切换器的内部Apple Bug。 UIInputSwitcherTableCellSegmentView是这些语言单元之一,而stackView实际上是语言切换器堆栈视图。