iOS 11 blank keyboard and internal layout conflict in UIInputSwitcherTableCellSegmentView

464 views Asked by At

Trying to port my project from iOS 10 to 11, all throughout the app keyboard is blank (see photo). Trying to switch between keyboards yields the following constraint conflict:

[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

There are 2 answers

2
Renen E. On

This is caused by an internal iOS 11 issue when the following extension is implemented. Remove the extension and the keyboard is back.

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
0
Schemetrical On

If anyone else is having issues with this, it seems like an internal apple bug with the keyboard switcher. UIInputSwitcherTableCellSegmentView is one of those language cells and the stackView is actually the language switcher stack view.