I have a simple tab-bar application with no code beyond the template provided from Xcode when starting a project.
I add a new UIViewController
, put a UITextView
inside of it, and change the text in it from the default to something short like "Console". (Autolayout or not is irrelevant.)
When I attempt I run the application (device or simulator - iOS 9) after tapping the tab with the UITextView
it freezes the app. The app doesn't crash, even after a long time, but all buttons become entirely unresponsive until quit.
Same happens for a simple single screen app with a UITextView with not much text.
The amount of text is tricky to determine, it's around 11 characters, but not exactly based on length (different amounts of different letters not entirely based on visual length seems to cause it: 11 a
's i
's or m
's will crash it, as will aaaabbbbc
, but aaaabbbbcc
will not).
The text must be plain, attributed text never causes the hang.
Appears to be stuck looping in objc_msgSend
, as best I can tell it goes from instruction on line 1 below up to line 26 and back to line 01 forever (or a few passes at least) but I don't know how to introspect assembly in Xcode's debug view so I'm stuck debugging as well.
libobjc.A.dylib`objc_msgSend:
01: 0x10c795800 <+0>: testq %rdi, %rdi
02: 0x10c795803 <+3>: jle 0x10c795850 ; <+80>
03: 0x10c795805 <+5>: movq (%rdi), %r11
04: 0x10c795808 <+8>: movq %rsi, %r10
05: 0x10c79580b <+11>: andl 0x18(%r11), %r10d
07: 0x10c79580f <+15>: shlq $0x4, %r10
08: 0x10c795813 <+19>: addq 0x10(%r11), %r10
09: 0x10c795817 <+23>: cmpq (%r10), %rsi
10: 0x10c79581a <+26>: jne 0x10c795820 ; <+32>
11: 0x10c79581c <+28>: jmpq *0x8(%r10)
12: 0x10c795820 <+32>: cmpq $0x1, (%r10)
13: 0x10c795824 <+36>: jbe 0x10c795833 ; <+51>
14: 0x10c795826 <+38>: addq $0x10, %r10
15: 0x10c79582a <+42>: cmpq (%r10), %rsi
16: 0x10c79582d <+45>: jne 0x10c795820 ; <+32>
17: 0x10c79582f <+47>: jmpq *0x8(%r10)
18: 0x10c795833 <+51>: jb 0x10c795871 ; <+113>
19: 0x10c795835 <+53>: movq 0x8(%r10), %r10
20: 0x10c795839 <+57>: jmp 0x10c795845 ; <+69>
21: 0x10c79583b <+59>: cmpq $0x1, (%r10)
22: 0x10c79583f <+63>: jbe 0x10c79584e ; <+78>
23: 0x10c795841 <+65>: addq $0x10, %r10
24: 0x10c795845 <+69>: cmpq (%r10), %rsi
25: 0x10c795848 <+72>: jne 0x10c79583b ; <+59>
26: 0x10c79584a <+74>: jmpq *0x8(%r10)
27: ... continues
Why does a UITextView with short text cause an app to hang?
Edit: This question initially presumed the hang only occurred when a UITextView
was inside of a UIScrollView
, but on further testing it happens regardless of UIScrollView
being present.