UITextView crashes with 100000+ characters

Have other developers experienced that a UITextView layout containing more than 100000 (a hundred thousand) characters crashes when you click (or tap) on the text layout? A simple code with a UITextView with 100000 characters works fine if you click (or tap) on the text area, but if there are 100001 or more characters, then a click/tap on the text will immediately crash the app. Note: a "scroll" will always work and the text can be scrolled up and down no matter the number of characters, but a simple click/tap will systematically crash the app. You may think that already handling 100000 characters is a lot, but imagine you enter the entire list of Zip Codes in the USA in your Text View, along with a comma separation, then we have over 300000 characters. This seems a bug as Apple Tech Support asked me to file a bug, then I posted the bug in Apple Developer Feedback Assistant, then I was asked to help them replicate the issue, which I did, but then I haven't received any further update on a workaround solution or a fix in the upcoming iOS 13. Thanks for sharing your thoughts, experience, and if possible, permanent or workaround solution.

Replies

Never used textView with that large text.


Which XCode version ? Which IOS version ?


Can you show the code where it crashes ? What is the crashlog ?

Do you get the problem on simulator or on device ?


If simulator, read this, that could be a simulator bug:

h ttps://github.com/contentful-graveyard/blog-app-ios/issues/1

I have the problem with both Simulators (iPad, iPhone) and real Devices (iPad, iPhone).

I tried with many iOS versions (older and newer), including several 13.0 betas on Simulator.


Below I have added a link to a DemoApp that can be built and replicate the crash:

- build and launch the app

- a UiTextView layout gets displayed (it has 100001 characters in it)

- you can scroll up/down the text but as soon as you CLICK or TAP on it, the app will CRASH


I reported the issue to Apple Tech Support, they asked me to contact Apple Developer Feedback Assistant, they asked me for a demo, I sent them the same DemoApp, but haven't heard from them since! Perhaps they have other priorities with iOS 13, Catalina, Catalyst, etc.


Thanks


Link to DemoApp source (Objective-C):

https://www.dropbox.com/s/hblpmqiqv9d8nil/DemoApp.zip?dl=0

I just tried again with the latest update of XCode 11 and built with iOS SDK 13.0 and ran it in Simulator and crash still happens.

I have seen the problem for several years on real devices with several iOS (9, 10, 11, 12)

The built-in controls are designed for small amounts of text. You will need to write a custom control. Note that all controls work this way.