Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
244 views
in Technique[技术] by (71.8m points)

ios - 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:

*** 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)'

Why is this happening? How can I prevent this crash?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Update: Fixed! ????

The ONLY Solution is to update

This bug is fixed in 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. (56808566, 56873523)


Xcode 11.2 is deprecated by Apple on November 5, 2019

if you ever try to submit your app that build with Xcode 11.2 to the AppStore, you will be rejected:

App Store Connect Operation Warning

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

So all workarounds done with the Xcode 11.2 is useless


It's a bug for Xcode 11.2, and fixed in 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

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.

You can find all other Xcode versions and other resources link (including release and beta versions) here at https://developer.apple.com/download/more

The workaround

This is very hard but working workaround. Replace all UITextViews in storyboards and Xibs with the pure code version.


Note that this bug is found and fixed by Apple

Fixed

Also earlier, the bug was confirmed by Apple Staff edford

Confirmation


For those with iOS 13.2 and can not use Xcode 11.1 anymore:

  1. Update macOS to 10.15.1 or later
  2. Install Xcode 11.2.1 or later
  3. It should be work now on the updated device.

For those with storyboard:

  1. Subclass UITextView
  2. Assign it to all UITextView objects
  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)

Head to the @aftab muhammed khan answer for Objective-C and @MikRo answer for Swift adapted version

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!

And once again:

Xcode 11.2 is deprecated by Apple on November 5, 2019


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...