Could not instantiate class named _UITextLayoutView

环境:xcode 11.2 

iPhone真机,若低于iOS13.2的系统,毕现;

产生原因:

xcode自身的BUG,该bug已被Apple 员工证实。链接如下:https://forums.developer.apple.com/thread/125287#391939

解决办法:

1、回退Xcode版本到11.1,

2、用代码创建textView

3、在用xib创建时,添加如下代码:

- (instancetype)initWithCoder:(NSCoder*)coder{

    if(@available(iOS13.2, *)) {

        return[superinitWithCoder:coder];

    }else{

        self = [super initWithFrame:CGRectZero textContainer:nil];

        self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

        self.contentMode = UIViewContentModeScaleToFill;

        self.scrollEnabled=false;

        self.translatesAutoresizingMaskIntoConstraints = false;

        self.font=***;

        self.textColor=***;//自定义颜色

        self.backgroundColor=***;

        return self;

    }

}

你可能感兴趣的:(Could not instantiate class named _UITextLayoutView)