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?
Best Answer
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.
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
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 thisNote 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/moreThe workaround
This is very hard but working workaround. Replace all
UITextView
s in storyboards and Xibs with the pure code version.Note that this bug is found and fixed by Apple
Also earlier, the bug was confirmed by Apple Staff edford
For those with iOS 13.2 and can not use Xcode 11.1 anymore:
For those with storyboard:
UITextView
UITextView
objectsFor 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 versionJust 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