ios - 从 Xcode 11.1 升级到 Xcode 11.2 后,应用程序因 _UITextLayoutView 崩溃

标签 ios swift xcode uitextview xcode11

从 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; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)'

为什么会发生这种情况?我怎样才能防止这种崩溃?

最佳答案

更新:已修复! 🎉🎊

唯一的解决方案是更新

这个bugfixed在 Xcode 11.2.1 中。所以你可以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. (56808566, 56873523)

<小时/>

Apple 已于 2019 年 11 月 5 日弃用 Xcode 11.2

如果您尝试将使用 Xcode 11.2 构建的应用程序提交到 AppStore,您将被拒绝:

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."

因此,使用 Xcode 11.2 完成的所有解决方法都是无用

<小时/>

这是 Xcode 11.2 的错误,已在 Xcode 11.2.1 中修复。

解决方案

回滚到以前的 Xcode release 版本: 回滚不再是一个选项,AppStore 将拒绝使用低于 11.2.1 的 Xcode 进行任何构建 take a look at this

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

请注意您应该使用 Safari 来下载它,并且必须首先login to Apple developer portal .

您可以在 https://developer.apple.com/download/more 找到所有其他 Xcode 版本和其他资源链接(包括发布版和测试版)。

解决方法

这是非常困难但有效的解决方法。 全部替换UITextView StoryboardXib中的纯代码版本。

<小时/>

请注意bug is found and fixed by Apple

Fixed

同样早些时候,the bug已被Apple Staff edford确认

Confirmation

<小时/>

对于使用 iOS 13.2 且无法再使用 Xcode 11.1 的用户:

  1. 将 macOS 更新到 10.15.1 或更高版本
  2. 安装 Xcode 11.2.1 或更高版本
  3. 现在应该可以在更新后的设备上运行了。

对于那些有 Storyboard的人:

  1. 子类UITextView
  2. 将其分配给所有人 UITextView对象
  3. 不要忘记更新子类化中可能丢失的任何属性更改。

对于那些熟悉方法调配(Objc 和动态行为)的人

前往@aftab muhammed khan answer for Objective-C和@MikRo answer for Swift adapted version

别再这样做了:

即使最后两个混合解决方法没有使用 Apple 私有(private) API,它们也会在 AppStore 中被拒绝,因为 Apple will not accept builds with Xcode versions under 11.2.1 !

再一次:

Apple 已于 2019 年 11 月 5 日弃用 Xcode 11.2

关于ios - 从 Xcode 11.1 升级到 Xcode 11.2 后,应用程序因 _UITextLayoutView 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58657087/

相关文章:

iphone - 在 iOS 中播放嵌入的 youtube 视频后返回特定 View

iphone - 嵌套的推送动画可能会导致导航栏损坏

swift - 能够在 Firebase 中对用户进行身份验证,但无法将用户数据存储在 Firebase 数据库中

swift - 如何将字典的值绑定(bind)到 SwiftUI 控件?

ios - 如何检测键盘高度何时更新?

iphone - Xcode 4 中的压缩应用程序 (.ipa) 比 Xcode 3 大吗?

ios - 我如何制作链接到 uiscrollview contentoffest 的 uiimageView 缩放动画?

objective-c - 检查两个或多个 CGRects 在 NSMutableArray 中时是否接触的好方法是什么?

iOS NSURLConnection 错误-1002

ios - Swift 2.0 UIImagePickerController 在关闭时关闭父 View