354

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Sudhakar Tharigoppula
  • 2,857
  • 3
  • 16
  • 17
  • Same issue for me also. My side, app is crashing only in iOS 13 below versions. – Harsha Nov 01 '19 at 11:34
  • 17
    Seems like the Xcode 11.2 bug. Check the thread https://forums.developer.apple.com/thread/125287 . Most likely it is related to the TextViews in the hierarchy – Pavel Stepanov Nov 01 '19 at 13:18
  • Try removing and then readding the view/class in IB. – Daniel Storm Nov 01 '19 at 13:18
  • 3
    @DanielStorm unfortunately, that did not help. I've just added a plain UITextView to one screen which did not have it before (and did not crash before as well :) ). Now it crashes with the same error. The issue persists for all the devices/simulators except for the latest iOS 13.2 – Pavel Stepanov Nov 01 '19 at 13:26
  • It has something to do with the UITextView added via Storyboard when testing on versions lower than iOS 13. I guess it is a bug in Xcode 11.2 because no problems with previous versions. – Tihomir RAdeff Nov 01 '19 at 11:16
  • I submitted the app from Xcode 11.1 only, but I'm getting the same issue. And also, searched for `_UITextLayoutView` in the workspace, but I found nothing. – Harsha Nov 01 '19 at 11:35
  • Yeah 11.2 has a serious bugs even in compiler cause it won't compile long expressions anymore though in release notes they said that it will compile longer expressions that 11.1... so I wasted yesterday to figureout why all my projects won't compile and returned to 11.1. I thought that the problem is in Swift 5.1.2, but the problem is in Xcode 11.2 itself. – imike Nov 02 '19 at 09:48
  • Unfortunately this does seem to happen when a text view is *anywhere in the app* , not just the first screen. :/ – Fattie Nov 02 '19 at 16:59
  • 3
    Does anybody know if this will crash production apps built with Xcode 11.2 when running on iOS 13.1.2 devices? – gfpacheco Nov 04 '19 at 13:41
  • @gfpacheco - my app crashed on iOS 13.1.2 generated from an Xcode 11.2 build. It doesn't crash once the device was updated to iOS 13.2. I haven't submitted to App Store but would assume it would be the same. – instAustralia Nov 05 '19 at 01:00
  • 2
    this is a perfectly good question, hence the 198 votes, so I am really not sure why someone marked it as "put on hold unclear" – Mike Volmar Nov 06 '19 at 22:30
  • 4
    @MikeVolmar I voted to close and no longer relevant. It's fixed with 11.2.1. This question had a very short window of usefulness. – rmaddy Nov 07 '19 at 00:17
  • 1
    The **accepted answer is deprecated by Apple** and it's not going to work! Even if it doesn't contain private API, it will not approve on the AppStore – Mojtaba Hosseini Nov 07 '19 at 12:41
  • Xcode 11.2.1 is available on App Store now. – Kanishk Gupta Nov 13 '19 at 06:59
  • This is still happening for me on 11.2.1 – Zee Nov 13 '19 at 09:13
  • @Sudhakar Tharigoppula Why you have accepted an answer that is **deprecated** and its **NOT even Swift!** as you originally asked for? – Mojtaba Hosseini Dec 03 '19 at 18:55

15 Answers15

221

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

Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
  • I think apple is messing with the ‘TextView’ because of SwiftUI support. It should be fixed on next version. – Mojtaba Hosseini Nov 01 '19 at 14:33
  • 3
    Sad, but the solution is working for me. Thanks! 11.1 works. I would not suggest converting to pure code, because i bet there is a fix coming out soon. If you don't mind: Update this answer once there is a new version that works. Would be bad if people start downloading 11.1 event though there is a fixed version out there :) – Sebastian Weiß Nov 01 '19 at 16:22
  • (FWIW I meant to link [the Xcode downloads question itself](https://stackoverflow.com/questions/7047735/where-can-i-download-old-versions-of-xcode/26289447), not a link to my answer on the question. Mentioned because there was a lot of activity on that Q/A today, likely related to this 11.2 issue.) – pkamb Nov 01 '19 at 22:06
  • 2
    I already have 11.1 but didn't work, i didn't upgrade to 11.2. – JAHelia Nov 03 '19 at 04:54
  • Yes - running in Xcode 11.1 worked for me too. Thx for the link. BTW: In the process discovered that Apple rejects builds compiled w/beta release of Xcode (Xcode 11.2 beta 2 in my case). – mark Nov 05 '19 at 04:32
  • But Apple _does not_ reject builds compiled with release 11.2, which will definitely crash on devices with iOS lower than 13.2 if they have UITextViews in their storyboards. – rommex Nov 05 '19 at 11:00
  • Xcode 11.2.1 GM seed was released to address the issue. – Cœur Nov 05 '19 at 23:55
  • Xcode 11.2.1 is available for download from the developer portal. It's not yet available the App Store. – Abhi Beckert Nov 06 '19 at 00:58
  • 6
    Please note that you should probably delete the app from your development device and/or clean Xcode's build folder (`CMD + Shift + K`) – Jeroen Nov 06 '19 at 15:32
  • 3
    How can I upgrade to v11.2.1 ? It's not showing up on the app store. And downloading the GM seed from the developer portal tries to download the app all over for about 8gb! – mesqueeb Nov 07 '19 at 01:40
  • 1
    @mesqueeb the previous version is deprecated by Apple and is no longer valid, (Unfortunately) There is no way to *upgrade*. You must download the new version entirely. – Mojtaba Hosseini Nov 07 '19 at 13:57
  • Okay this is great, but can we make it so that the current version Catalina downloads on appstore version 11.2.1? Right now it STILL defaults to 11.2 – Malcolm Salvador Nov 08 '19 at 01:08
  • 3
    Also if it's deprecated, why doesn't apple just remove 11.2 on the app store for now? – Malcolm Salvador Nov 08 '19 at 01:12
  • ok, I have downloaded 11.2.1 version form apple site and now, how can update from 11.2 in my mac without apple store? – Ricko.. Nov 08 '19 at 07:58
  • 1
    @RickyA. Just delete the old one and move the new one to application folder – Mojtaba Hosseini Nov 08 '19 at 09:36
  • 1
    You can look at the logs from AppStore I mentioned in the answer @MalcolmSalvador . At the beginning of the solutions section – Mojtaba Hosseini Nov 08 '19 at 09:39
  • Still had the issue after upgrade to 11.2.1. NBD; Quit Xcode, deleted ALL derived data, deleted app from my iOS 9.3 test device. New build worked this time. Just a heads up to delete the derived data as there is a ghost of this issue in there. – Berry Wing Nov 13 '19 at 04:16
  • Yes, you have to Clean Build Folder in order for the fix to work, as I just found out, too – Michael Konz Nov 22 '19 at 08:09
  • Is this solution possible to implement for non-native apps (JavaScript-related using Cordova)? – Daniel Danielecki Nov 26 '19 at 19:10
144

Congratulation

The New version of Xcode (11.2.1) is available now which is the best way to get rid off this issue.

Workarounds

@Mojtaba Hosseini the solution I proposed was from the help and the participation from my side to my fellow developers over StackOverflow. You, me and all the rest of the developer here already know that when the new version is announced by Apple, this issue will be gone.

But Beside Everything

The solution aforementioned was definitely accepted by Apple Review as there is no private API involved at all. This approach is very similar to the creating property like

@interface UITextView (Layout)

Or

UITextView+Layout.h

So when you are creating property you are directly using APPLE Private Components and re-moduling them as per you depends or requirement.

The Simple Example is AMFNetworking classes

- (void)setImageWithURL:(NSURL *)url {
    [self setImageWithURL:url placeholderImage:nil];
}

Hope I am done with the Allegation

The answer below was just some help from my side to enable developer to continue developing as you we initially proposed developer to roll back Xcode. This was a bad practice to download 8 GB Xcode again since we all know that the new version of Xcode will be released soon.

While it is fixed in Xcode 11.2.1, I got one solution for Xcode 11.2 by which you can get rid off this crash:

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

SOLUTION

Go to the Build Setting search for "DEAD_CODE_STRIPPING" and set it to NO

DEAD_CODE_STRIPPING = NO

Then

create files UITextViewWorkaround

UITextViewWorkaround.h

    #import <Foundation/Foundation.h>


    @interface UITextViewWorkaround : NSObject
    + (void)executeWorkaround; 
@end

UITextViewWorkaround.m

#import "UITextViewWorkaround.h"
#import  <objc/runtime.h>



    @implementation UITextViewWorkaround

    + (void)executeWorkaround {
        if (@available(iOS 13.2, *)) {
        }
        else {
            const char *className = "_UITextLayoutView";
            Class cls = objc_getClass(className);
            if (cls == nil) {
                cls = objc_allocateClassPair([UIView class], className, 0);
                objc_registerClassPair(cls);
    #if DEBUG
                printf("added %s dynamically\n", className);
    #endif
            }
        }
    }

    @end

execute it in the app delegate

#import "UITextViewWorkaround.h"

        - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
            // Override point for customization after application launch.

            [UITextViewWorkaround executeWorkaround];
    return yes;
    }

Compile the code and you will have a running app :)

cokeman19
  • 2,405
  • 1
  • 25
  • 40
AFTAB MUHAMMED KHAN
  • 2,189
  • 3
  • 18
  • 24
  • Is this a specific solution for objC or is this also useful for Swift? Can I keep my StoryBoard references when i implement this? – Hardy_Germany Nov 04 '19 at 19:17
  • Yes this will work for both you just need to change the code in swift and the good part is that you don’t need to change the story board reference – AFTAB MUHAMMED KHAN Nov 04 '19 at 19:30
  • 2
    If its working for you kindly rank up so other can try this solution as well – AFTAB MUHAMMED KHAN Nov 04 '19 at 19:49
  • Well, unfortunately I do not "speak" objC at all ;-) I googled a little bit around and found some hints that this "objc_getClass(className)" kind of declaration is not allowed in Swift. There must be a way to declare this in objC and call it from Swift Apllication Delegate (within the "didFinishLaunchingWith..."), but I have no idea how to do it .. maybe someone else can provide this for a swift environment .. it sounds SOOO good ;-) – Hardy_Germany Nov 04 '19 at 19:51
  • 3
    @Hardy_Germany I tested this a little, for Swift you can try: class UITextViewWorkaround: NSObject { class func executeWorkaround() { if #available(iOS 13.2, *) { } else { let className = "_UITextLayoutView" var cls = objc_getClass(className) if cls == nil { cls = objc_allocateClassPair(UIView.self, className, 0) objc_registerClassPair(cls as! AnyClass) #if DEBUG print("added %@ dynamically\n", className); #endif } } } } – John Nimis Nov 04 '19 at 21:58
  • YESSS! it works! Will provide an answer with better readable source code in a minute (of course with reference to both of you) ... GOOD WORK!! – Hardy_Germany Nov 04 '19 at 22:18
  • With the testing I have done, seems changing the DEAD_CODE_STRIPPING value isn't necessary. Only need to implement the Workaround function. – DaveDude Nov 05 '19 at 02:12
  • 2
    @DaveDude DEAD_CODE_STRIPPING = NO is needed if you use Swift Package Manager with Xcode 11.2 – Cœur Nov 05 '19 at 03:12
  • @DaveDude i mentioned this here because i did these steps if you find yourself un - useful so forgot these line. – AFTAB MUHAMMED KHAN Nov 05 '19 at 08:34
  • @aftab is it working after the release app as well? – Pradip Sutariya Nov 05 '19 at 11:21
  • 5
    @pradipsutariya yes off-course why not we never change anything in APPLE CLASSES. – AFTAB MUHAMMED KHAN Nov 05 '19 at 11:22
  • 5
    Only Xcode 11.2.1 GM seed(beta) is Released. Stable version may release soon. – Lal Krishna Nov 07 '19 at 05:57
  • 1
    Cannot distribute app with Xcode 11.2 anymore. It will be rejected. `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.` – AechoLiu Nov 07 '19 at 07:09
  • Still have this issue on Xcode 11.3.1. Am I the only one? – Kirill Feb 27 '20 at 20:11
40

The issue was fixed in Xcode 11.2.1.

EDIT: As the fix is now released, you should switch to that Xcode version and comment out this workaround. As Mojtaba Hosseini in his answer mentioned:

... these last two swizzling workarounds are using Apple private API and will be reject from Apple review!

For the time until the fix was released by Apple, this was a good workaround to continue developing and testing.


For Xcode 11.2, based on the idea of Aftab Muhammed Khan and with the help of John Nimis I just tested the following code.

No change in the storyboard files necessary!

Edited my AppDelegate.swift file and added this class

//******************************************************************
// MARK: - Workaround for the Xcode 11.2 bug
//******************************************************************
class UITextViewWorkaround: NSObject {

    // --------------------------------------------------------------------
    // MARK: Singleton
    // --------------------------------------------------------------------
    // make it a singleton
    static let unique = UITextViewWorkaround()

    // --------------------------------------------------------------------
    // MARK: executeWorkaround()
    // --------------------------------------------------------------------
    func executeWorkaround() {

        if #available(iOS 13.2, *) {

            NSLog("UITextViewWorkaround.unique.executeWorkaround(): we are on iOS 13.2+ no need for a workaround")

        } else {

            // name of the missing class stub
            let className = "_UITextLayoutView"

            // try to get the class
            var cls = objc_getClass(className)

            // check if class is available
            if cls == nil {

                // it's not available, so create a replacement and register it
                cls = objc_allocateClassPair(UIView.self, className, 0)
                objc_registerClassPair(cls as! AnyClass)

                #if DEBUG
                NSLog("UITextViewWorkaround.unique.executeWorkaround(): added \(className) dynamically")
               #endif
           }
        }
    }
}

and within the delegate call for "didFinishLaunchingWithOptions" call the workaround

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    // Override point for customization after application launch.

    // This is the workaround for Xcode 11.2
    UITextViewWorkaround.unique.executeWorkaround()
}
Hardy_Germany
  • 1,259
  • 13
  • 19
34

I've adapted khan's Obj-C solution to Swift:

import UIKit

@objc
class UITextViewWorkaround : NSObject {

    static func executeWorkaround() {
        if #available(iOS 13.2, *) {
        } else {
            let className = "_UITextLayoutView"
            let theClass = objc_getClass(className)
            if theClass == nil {
                let classPair: AnyClass? = objc_allocateClassPair(UIView.self, className, 0)
                objc_registerClassPair(classPair!)
            }
        }
    }

}

Call it at the end of didFinishLaunchingWithOptions in AppDelegate.

Thanks @Aftab!

Nike Kov
  • 12,630
  • 8
  • 75
  • 122
MikRo
  • 536
  • 4
  • 6
22

A quicker fix:

///Substitute class for _UITextLayoutView bug
class FixedTextView: UITextView {
    required init?(coder: NSCoder) {
        if #available(iOS 13.2, *) {
            super.init(coder: coder)
        }
        else {
            let rect = CGRect(origin: .zero, size: CGSize(width: 100, height: 44*3))
            super.init(frame: rect, textContainer: nil)
        }
    }
}

Add this code somewhere and then replace all storyboard instances to FixedTextView.

Note: you will lose any attributes created in the storyboards. This could have serious implications (e.g. delegate setting, size, etc.)

garafajon
  • 1,278
  • 13
  • 15
18

Updated Solution: Update to Xcode 11.2.1. It works on iOS 11, 12 or 13 devices for me.

Refer to apple's documentation This update fixes a critical issue that could cause apps using UITextView to crash.

Old Solution: Downloaded Xcode 11.1 from https://developer.apple.com/download/more/ Switching back from 11.2 to 11.1 fixed the crash.

Also, for me even with Xcode 11.2, when I upgraded my iPhone to 13.2, that fixed the crash.

anoo_radha
  • 812
  • 1
  • 15
  • 34
17

11.2.1 GM seed resolves this issue

(and it can be used to publish to App Store)

Go to https://developer.apple.com/download/. Download Xcode 11.2.1 GM seed

Release notes confirm it fixes this error:

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
craft
  • 2,017
  • 1
  • 21
  • 30
  • 5
    Please note that after installing Xcode 11.2.1 GM seed you should probably delete the app from your development device and/or clean Xcode's build folder (CMD + Shift + K). – Wojtek Dmyszewicz Nov 06 '19 at 15:49
13

You can go to download the last Xcode beta release (11.2.1 GM) from Apple developer website.

Here the direct link

Xcode 11.2.1 GM seed

pkamb
  • 33,281
  • 23
  • 160
  • 191
Oscar TJ
  • 524
  • 3
  • 16
  • Please note that after installing Xcode 11.2.1 GM seed you should probably delete the app from your development device and/or clean Xcode's build folder (CMD + Shift + K). – Wojtek Dmyszewicz Nov 06 '19 at 15:49
  • installed and run without any other procedure. Problem fixed ✌️ – Oscar TJ Nov 06 '19 at 17:57
  • how do I install this ? It gave me a folder, but there is no executable – Scobee Nov 07 '19 at 11:47
  • 1
    just download zip from the link provided and extract it. Then copy the App in Application folder. – Oscar TJ Nov 07 '19 at 11:49
  • 1
    the problem is that when I extract it, I get two files, Content and Metadata ... thats why I asked what to do with them. I used an archive utility because clicking on it normally was failing. I'll try again – Scobee Nov 07 '19 at 11:56
  • this is strange...try to download it again. I know that we are talking about 7 Gb but try it – Oscar TJ Nov 07 '19 at 12:25
12

Improving on @garafajon answer. For me it works in most cases.

///Substitute class for _UITextLayoutView bug
class FixedTextView: UITextView {
    required init?(coder: NSCoder) {
        if #available(iOS 13.2, *) {
            super.init(coder: coder)
        }
        else {
            super.init(frame: .zero, textContainer: nil)
            self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
            self.contentMode = .scaleToFill

            self.isScrollEnabled = false   // causes expanding height

            // Auto Layout
            self.translatesAutoresizingMaskIntoConstraints = false
            self.font = UIFont(name: "HelveticaNeue", size: 18)
        }
    }
}
Awsom3D
  • 920
  • 7
  • 22
  • 1
    Works perfectly. @garafajon's code caused issues with boxes in unexpected places. This fixes those issues~ great job! – ekrenzin Nov 04 '19 at 15:19
8

As a "quick" fix you can add the UITextView directly from the code and not via IB. 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.

Pavel Stepanov
  • 891
  • 8
  • 13
6

It is a bug with Xcode 11.2. Subclassed Textviews are crashing on all devices not having the neweset iOS build (13.2) installed. You probably better not build a release with that build.

You can now:

  • downgrade Xcode to 11.1 or
  • upgrade your device to iOS 13.2
Cœur
  • 37,241
  • 25
  • 195
  • 267
mark.so.cgn
  • 97
  • 1
  • 3
6

I used a successful workaround, but it was painful. This is the process that I followed:

  1. Open the XIB in a text editor
  2. Find the offending TextView. In my case:
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="782-j1-88c" customClass="LCAnsiConsoleTextView">
  <rect key="frame" x="16" y="20" width="343" height="589"/>
  <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
  <fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="12"/>
  <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
  1. Note its id (in my case: id="782-j1-88c")
  2. Override the class as noted in the answers above and recreate the options (mine is Objective-C, sorry):
@implementation FixedTextView

- (id) initWithCoder:(NSCoder*)coder
{
    if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){13,2,0}])
        self = [super initWithCoder:coder];
    else {
        self = [super initWithFrame:CGRectMake(16, 3, 343, 605)];
        self.editable = YES;
        self.selectable = YES;
        self.insetsLayoutMarginsFromSafeArea = YES;
        self.clipsToBounds = YES;
        self.clearsContextBeforeDrawing = YES;
        self.autoresizesSubviews = YES;
        self.contentMode = UIViewContentModeScaleToFill;
        self.scrollEnabled = YES;
        self.userInteractionEnabled = YES;
        self.multipleTouchEnabled = YES;
        self.translatesAutoresizingMaskIntoConstraints = NO;
        self.font = [UIFont fontWithName:@"Menlo-Regular" size:12.0];
    }
    return self;
}
  1. Note the constraints that include your text view id, and recreate those constraints against the other element ids in your view or view controller. In my case:
- (id) initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
        [self xibSetup];
        [self initView];
/*
        <constraint firstItem="75C-lt-YtE" firstAttribute="top" secondItem="782-j1-88c" secondAttribute="bottom" constant="8" symbolic="YES" id="8SH-5l-FAs"/>
        <constraint firstItem="782-j1-88c" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leadingMargin" id="Mve-aZ-HCe"/>
        <constraint firstItem="782-j1-88c" firstAttribute="leading" secondItem="75C-lt-YtE" secondAttribute="leading" id="dPG-u3-cCi"/>
        <constraint firstItem="782-j1-88c" firstAttribute="trailing" secondItem="iN0-l3-epB" secondAttribute="trailingMargin" id="sjT-0Q-hNj"/>
        <constraint firstItem="782-j1-88c" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="vic-vZ-osR"/>
*/
        [self.command.topAnchor constraintEqualToAnchor:self.console.bottomAnchor constant:8].active = YES;
        [self.console.leadingAnchor constraintEqualToAnchor:self.layoutMarginsGuide.leadingAnchor].active = YES;
        [self.console.leadingAnchor constraintEqualToAnchor:self.command.leadingAnchor].active = YES;
        [self.console.trailingAnchor constraintEqualToAnchor:self.trailingAnchor].active = YES;
        [self.console.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor].active = YES;

    }
    return self;
}

Doing this fixed the issue for me with no loss in desired functionality. Fortunately I had only one UITextView to replace. Otherwise, this gets untenable.

Eric Lange
  • 1,755
  • 2
  • 19
  • 25
2

I had the same issue I just upgraded my Xcode 11.2 to 11.2.1 it worked fine.

After upgrade I have tested the same on iOs 13 and iOS 12 and it was working fine.

Mohammad Parvez
  • 409
  • 4
  • 12
0

1. Problem:

There is an issue with Xcode 11.2 wherein Storyboards containing a UITextView will cause the app to crash on OS versions earlier than iOS 13.2 if compiled with Xcode 11.2.

Xcode 11.2

Check this apple documentation.

2. Solution:

The only solution is to update your Xcode to 11.2.1 or 11.3.

Xcode 11.2.1 was particularly released to fix this crash issue.

enter image description here Check this apple documentation.

3. Suggestion:

I would suggest you to go with latest version of Xcode 11.3 since this supports developing apps for iOS 13.3 and also there are many new features. Check this apple documentation.

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
-1

This issue was fixed in Xcode version 11.2.1, and called out in the release notes:

This update fixes a critical issue that could cause apps using UITextView to crash

Xcode release notes screenshot

pkamb
  • 33,281
  • 23
  • 160
  • 191