XCode升级到11.2,发现原来用到XIB的子类代码界面会在IOS12机型闪退

升级Xcode到11.2后,使用XIB的子类在iOS12设备上出现闪退问题,错误提示涉及_UITextLayoutView。通过网上资料和同事研究,采取在AppDelegate中动态重载缺失层的方法,通过创建UITextViewWorkaround类成功解决此问题。该方案同样适用于其他因Xcode升级导致的xib界面加载闪退问题,特别是在iOS12上,而不会影响iOS13。
摘要由CSDN通过智能技术生成

XCode升级到11.2,发现原来用到XIB的子类代码界面会在IOS12机型闪退。最后定位问题提示如下:

Could not instantiate class named _UITextLayoutView because no class named _UITextLayoutView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)

 

在网上查找资料,见https://www.jianshu.com/p/9c5bd2636552

建议1是手写代码避坑;2是下载老版本的Xcode。

但是这两个方法 都很耗时  而且会引发不可预知问题。

 

后来和同事研究,决定在 加载界面的 AppDelegate位置,硬打补丁代码予以实现,把缺失的层,予以编译时候动态重载,予以彻底解决。

具体如下:

........

#import "UITextViewWorkaround.h"

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

......

//解决Xcode 不能读取textView xib 崩溃
    [UITextViewWorkaround executeWorkaround];
    return YES;

}</
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值