从Xcode 11.1升级到Xcode 11.2后,由于_UITextLayoutView,应用程序崩溃

本文翻译自:After upgrading to Xcode 11.2 from Xcode 11.1, app crashes due to _UITextLayoutView

After upgrading to Xcode 11.2 from Xcode 11.1 my app crashes: 从Xcode 11.1升级到Xcode 11.2之后,我的应用崩溃了:

*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named _UITextLayoutView because no class named _UITextLayoutView was found; ***由于未捕获的异常'NSInvalidUnarchiveOperationException'而终止应用程序,原因:'由于未找到名为_UITextLayoutView的类,因此无法实例化名为_UITextLayoutView的类; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)' 该类需要在源代码中定义或从库中链接(确保该类是正确目标的一部分)'

Why is this happening? 为什么会这样呢? How can I prevent this crash? 如何防止此崩溃?


#1楼

参考:https://stackoom.com/question/3y7O3/从Xcode-升级到Xcode-后-由于-UITextLayoutView-应用程序崩溃


#2楼

This is because of xCode update to 11.2 version. 这是因为xCode更新到11.2版本。 Try with an older xCode version to see if is still crashing. 尝试使用较旧的xCode版本,以查看是否仍然崩溃。 Apple don't have a fix for this yet. 苹果尚未对此进行修复。


#3楼

在低于iOS 13的版本上进行测试时,它与通过Storyboard添加的UITextView有关。我认为这是Xcode 11.2中的错误,因为以前的版本没有问题。


#4楼

在iOS 13.1上看到相同的问题...在iOS 13.2上工作正常


#5楼

As a "quick" fix you can add the UITextView directly from the code and not via IB. 作为“快速”修复,您可以直接从代码中而不是通过IB添加UITextView At least it worked for me. 至少对我有用。 Though from my point of view it's better to rollback to previous Xcode/wait for the new one. 虽然从我的角度来看,最好回滚到以前的Xcode /等待新的Xcode。


#6楼

Update: Fixed! 更新:固定! 🎉🎊 🎉🎊

The ONLY Solution is to update 唯一的解决方案是更新

This bug is fixed in Xcode 11.2.1. 错误已在Xcode 11.2.1中修复 So you can download and use it from here. 因此,您可以从此处下载并使用它。

Storyboards containing a UITextView will no longer cause the app to crash on operating system versions earlier than iOS 13.2, tvOS 13.2, or macOS 10.15.2. 包含UITextView的情节提要板将不再导致应用程序在iOS 13.2,tvOS 13.2或macOS 10.15.2之前的操作系统版本上崩溃。 (56808566, 56873523) (56808566,56873523)


Xcode 11.2 is deprecated by Apple on November 5, 2019 Apple已于2019年11月5日弃用Xcode 11.2

if you ever try to submit your app that build with Xcode 11.2 to the AppStore, you will be rejected: 如果您曾经尝试将使用Xcode 11.2构建的应用提交到AppStore,则将被拒绝:

App Store Connect Operation Warning App Store Connect操作警告

WARNING ITMS-90703 : "Deprecated Xcode Build. Due to resolved app archives issues, we have deprecated Xcode 11.2 on November 5, 2019. Download Xcode 11.2.1 or newer, rebuild your app and resubmit." 警告ITMS-90703 :“不建议使用Xcode Build。由于已解决的应用程序存档问题,我们已于2019年11月5日弃用了Xcode 11.2。下载Xcode 11.2.1或更高版本,重建您的应用程序并重新提交。”

So all workarounds done with the Xcode 11.2 is useless 因此,使用Xcode 11.2完成的所有变通办法都没有用


It's a bug for Xcode 11.2, and fixed in Xcode 11.2.1. 这是Xcode 11.2的错误,已在Xcode 11.2.1中修复。

Solution(s) 解决方案

Roll back to previous Xcode release version from: Rollback is not an option anymore and AppStore will reject any build with Xcode below 11.2.1 take a look at this 回滚到之前的Xcode 发布版本从:回滚是不是一种选择了和AppStore的将拒绝任何的Xcode构建以下11.2.1 看看这个

https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.1/Xcode_11.1.xip https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.1/Xcode_11.1.xip

Note that you should use Safari to download it and you must first login to Apple developer portal . 请注意,您应该使用Safari下载它,并且必须首先登录到Apple开发人员门户

You can find all other Xcode versions and other resources link (including release and beta versions) here at https://developer.apple.com/download/more 您可以在https://developer.apple.com/download/more上找到所有其他Xcode版本和其他资源链接(包括发行版和Beta版)。

The workaround 解决方法

This is very hard but working workaround. 这非常困难,但是可以解决。 Replace all UITextView s in storyboard s and Xib s with the pure code version. 纯代码版本替换StoryboardXib中的所有UITextView


Note that this bug is found and fixed by Apple 请注意,错误已由Apple找到并修复。

固定

Also earlier, the bug was confirmed by Apple Staff edford 同样, 该错误已由Apple Staff edford确认

确认书


For those with iOS 13.2 and can not use Xcode 11.1 anymore: 对于使用iOS 13.2且无法再使用Xcode 11.1的用户:

  1. Update macOS to 10.15.1 or later 将macOS更新到10.15.1或更高版本
  2. Install Xcode 11.2.1 or later 安装Xcode 11.2.1或更高版本
  3. It should be work now on the updated device. 现在应该可以在更新的设备上工作了。

For those with storyboard: 对于那些拥有分镜脚本的用户:

  1. Subclass UITextView 子类UITextView
  2. Assign it to all UITextView objects 将其分配给所有UITextView对象
  3. Don't forget to update any property changes that may lose in the subclassing. 不要忘记更新可能在子类中丢失的任何属性更改。

For those comfortable with method swizzling (Objc and dynamic behavior) 对于那些习惯方法混乱的人(OBJC和动态行为)

Head to the @aftab muhammed khan answer for Objective-C and @MikRo answer for Swift adapted version 转到Objective-C@aftab muhammed khan 答案Swift适应版本的 @MikRo 答案

Just don't do it anymore: 只是不再这样做:

Even if these last two swizzling workarounds are not using Apple private API , they will be rejected in AppStore because Apple will not accept builds with Xcode versions under 11.2.1 ! 即使这最后两个麻烦的解决方法没有使用Apple私有API ,它们也会在AppStore中被拒绝 ,因为Apple不会接受11.2.1下的Xcode版本的构建

And once again: 再一次:

Xcode 11.2 is deprecated by Apple on November 5, 2019 Apple已于2019年11月5日弃用Xcode 11.2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值