赞
踩
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;
-
- }
</
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。