美文网首页
xcode11:Could not instantiate cl

xcode11:Could not instantiate cl

作者: 冲云简 | 来源:发表于2019-12-30 11:44 被阅读0次

    xcode11加载xib的UITextView报错。
    解决方案一:UITextView控件用代码重新手写。
    解决方案二:新建UITextViewWorkaround一个继承NSObject的类。如下:

    @interface UITextViewWorkaround : NSObject
    
    + (void)executeWorkaround;
    @end
    
    @implementation UITextViewWorkaround
    
    + (void)executeWorkaround {
      if (@available(iOS 13.2, *)) {
        
      }else {
        const char *className = "_UITextLayoutView";
        Class class1 = objc_getClass(className);
        if (nil == class1) {
          class1 = objc_allocateClassPair([UIView class], className, 0);
          objc_registerClassPair(class1);
    #if DEBUG
          printf("added %s dynamically\n", className);
    #endif
        }
      }
    }
    @end
    

    相关文章

      网友评论

          本文标题:xcode11:Could not instantiate cl

          本文链接:https://www.haomeiwen.com/subject/ezgpoctx.html