0

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.

owenfi
  • 2,471
  • 1
  • 24
  • 37
  • Goes without saying that I'm filing a bug with Apple on this one, just figured it might be helpful to others who run into as well to be documented here. I think it might've even been happening in Xcode 6/ios8 but can't confirm at the moment. – owenfi Oct 15 '15 at 03:58
  • Okay, this appears to be a dupe of: http://stackoverflow.com/questions/32699509/ios-swift-2-0-uitextview-freezes-app-depending-on-text http://stackoverflow.com/questions/32643765/ios-9-segue-causes-app-to-freeze-no-crash-or-error-thrown/32661264#32661264 http://stackoverflow.com/questions/32688799/xcode-7-crash-nslocalizablestring-length-30000 I see no mention of Apple bug numbers in there, and I arrived at it a bit differently, so I'm leaving it until someone says otherwise. (My radar number is `23123334`) – owenfi Oct 15 '15 at 08:09

0 Answers0