I am frequently getting a crash log related to UITextfield from our live users. It has been reported on only iOS 13.x and not specific to any iPhone device. There is no origin of error mentioned in the stack trace that can help in debugging.
Please refer to stack trace below. textField:shouldChangeCharactersInRange:replacementString is recursively called by our app that leads to crash. It has not been mentioned from where. I have tried to reproduce by different means, but unable to do so. Can anyone draw a guess what may cause this crash?
Thanks.
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x000000016f29fff8
Crashed: com.apple.main-thread
0 libsystem_pthread.dylib 0x1a00657b0 ___chkstk_darwin + 64
1 UIFoundation 0x1a38fb050 -[NSGlyphGenerator generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex:] + 44
2 UIFoundation 0x1a38fc170 -[NSLayoutManager(NSPrivate) _fillGlyphHoleForCharacterRange:startGlyphIndex:desiredNumberOfCharacters:] + 700
3 UIFoundation 0x1a393e83c _NSFastFillAllGlyphHolesForCharacterRange + 900
4 UIFoundation 0x1a38fc6a8 -[NSLayoutManager glyphRangeForCharacterRange:actualCharacterRange:] + 56
5 UIFoundation 0x1a38ead38 -[NSLayoutManager(NSPrivate) _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 700
6 UIFoundation 0x1a38ef7b4 -[NSLayoutManager(NSPrivate) _fillLayoutHoleAtIndex:desiredNumberOfLines:] + 196
7 UIFoundation 0x1a38f7240 -[NSLayoutManager(NSPrivate) _markSelfAsDirtyForBackgroundLayout:] + 424
8 UIFoundation 0x1a38f1dd8 -[NSLayoutManager(NSPrivate) _invalidateLayoutForExtendedCharacterRange:isSoft:invalidateUsage:] + 2332
9 UIFoundation 0x1a38f206c -[NSLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] + 212
10 UIFoundation 0x1a38f1f18 -[NSTextStorage _notifyEdited:range:changeInLength:invalidatedRange:] + 184
11 UIFoundation 0x1a38ef824 -[NSTextStorage endEditing] + 92
12 UIFoundation 0x1a3903a0c -[NSTextStorage coordinateEditing:] + 68
13 UIKitCore 0x1a468541c -[UIFieldEditor _setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText:] + 676
14 UIKitCore 0x1a4684e1c -[UIFieldEditor _setTextInRange:replacementText:andSetCaretSelectionAfterText:] + 204
15 UIKitCore 0x1a4697434 -[UITextField setText:] + 436
16 MyApp-QA 0x100a9e53c -[TextField textField:shouldChangeCharactersInRange:replacementString:] + 311 (TextField.m:311)
17 UIKitCore 0x1a46a3128 -[UITextField _delegateShouldChangeCharactersInTextStorageRange:replacementString:delegateCares:] + 160
18 UIKitCore 0x1a469cee8 -[UITextField keyboardInput:shouldReplaceTextInRange:replacementText:] + 92
19 UIKitCore 0x1a41fc56c -[UIKeyboardImpl acceptAutocorrection:executionContextPassingTIKeyboardCandidate:] + 536
20 UIKitCore 0x1a41ff6d4 -[UIKeyboardImpl acceptPredictiveInput:executionContext:] + 664
21 UIKitCore 0x1a41f5024 -[UIKeyboardImpl inputManagerDidGenerateAutocorrections:executionContext:] + 668
22 UIKitCore 0x1a4221d88 -[UIKeyboardTaskEntry execute:] + 180
23 UIKitCore 0x1a42207b8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 316
24 UIKitCore 0x1a4220b20 -[UIKeyboardTaskQueue performTaskOnMainThread:waitUntilDone:] + 320
25 UIKitCore 0x1a41de6a4 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 156
26 UIKitCore 0x1a41f1d18 -[UIKeyboardImpl selectionDidChange:] + 340
27 UIKitCore 0x1a46af9fc __52-[UITextInputController _coordinateSelectionChange:]_block_invoke + 504
28 UIFoundation 0x1a38f4b64 -[NSTextStorage coordinateReading:] + 56
29 UIKitCore 0x1a46af7dc -[UITextInputController _coordinateSelectionChange:] + 148
30 UIKitCore 0x1a46af364 -[UITextInputController _setSelectedTextRange:] + 452
31 UIKitCore 0x1a46af190 -[UITextInputController setSelectedRange:] + 72
32 UIKitCore 0x1a4685498 -[UIFieldEditor _setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText:] + 800
33 UIKitCore 0x1a4684e1c -[UIFieldEditor _setTextInRange:replacementText:andSetCaretSelectionAfterText:] + 204
34 UIKitCore 0x1a4697434 -[UITextField setText:] + 436
35 MyApp-QA 0x100a9e53c -[TextField textField:shouldChangeCharactersInRange:replacementString:] + 311 (TextField.m:311)
36 UIKitCore 0x1a46a3128 -[UITextField _delegateShouldChangeCharactersInTextStorageRange:replacementString:delegateCares:] + 160
37 UIKitCore 0x1a469cee8 -[UITextField keyboardInput:shouldReplaceTextInRange:replacementText:] + 92
38 UIKitCore 0x1a41fc56c -[UIKeyboardImpl acceptAutocorrection:executionContextPassingTIKeyboardCandidate:] + 536
39 UIKitCore 0x1a41ff6d4 -[UIKeyboardImpl acceptPredictiveInput:executionContext:] + 664
40 UIKitCore 0x1a41f5024 -[UIKeyboardImpl inputManagerDidGenerateAutocorrections:executionContext:] + 668
41 UIKitCore 0x1a4221d88 -[UIKeyboardTaskEntry execute:] + 180
42 UIKitCore 0x1a42207b8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 316
43 UIKitCore 0x1a4220b20 -[UIKeyboardTaskQueue performTaskOnMainThread:waitUntilDone:] + 320
44 UIKitCore 0x1a41de6a4 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 156
45 UIKitCore 0x1a41f1d18 -[UIKeyboardImpl selectionDidChange:] + 340
46 UIKitCore 0x1a46af9fc __52-[UITextInputController _coordinateSelectionChange:]_block_invoke + 504
47 UIFoundation 0x1a38f4b64 -[NSTextStorage coordinateReading:] + 56
48 UIKitCore 0x1a46af7dc -[UITextInputController _coordinateSelectionChange:] + 148
49 UIKitCore 0x1a46af364 -[UITextInputController _setSelectedTextRange:] + 452
50 UIKitCore 0x1a46af190 -[UITextInputController setSelectedRange:] + 72
51 UIKitCore 0x1a4685498 -[UIFieldEditor _setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText:] + 800
52 UIKitCore 0x1a4684e1c -[UIFieldEditor _setTextInRange:replacementText:andSetCaretSelectionAfterText:] + 204
53 UIKitCore 0x1a4697434 -[UITextField setText:] + 436
54 MyApp-QA 0x100a9e53c -[TextField textField:shouldChangeCharactersInRange:replacementString:] + 311 (TextField.m:311)
55 UIKitCore 0x1a46a3128 -[UITextField _delegateShouldChangeCharactersInTextStorageRange:replacementString:delegateCares:] + 160
56 UIKitCore 0x1a469cee8 -[UITextField keyboardInput:shouldReplaceTextInRange:replacementText:] + 92
57 UIKitCore 0x1a41fc56c -[UIKeyboardImpl acceptAutocorrection:executionContextPassingTIKeyboardCandidate:] + 536
58 UIKitCore 0x1a41ff6d4 -[UIKeyboardImpl acceptPredictiveInput:executionContext:] + 664
59 UIKitCore 0x1a41f5024 -[UIKeyboardImpl inputManagerDidGenerateAutocorrections:executionContext:] + 668
60 UIKitCore 0x1a4221d88 -[UIKeyboardTaskEntry execute:] + 180
61 UIKitCore 0x1a42207b8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 316
62 UIKitCore 0x1a4220b20 -[UIKeyboardTaskQueue performTaskOnMainThread:waitUntilDone:] + 320
63 UIKitCore 0x1a41de6a4 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 156
64 UIKitCore 0x1a41f1d18 -[UIKeyboardImpl selectionDidChange:] + 340
65 UIKitCore 0x1a46af9fc __52-[UITextInputController _coordinateSelectionChange:]_block_invoke + 504
66 UIFoundation 0x1a38f4b64 -[NSTextStorage coordinateReading:] + 56
67 UIKitCore 0x1a46af7dc -[UITextInputController _coordinateSelectionChange:] + 148
68 UIKitCore 0x1a46af364 -[UITextInputController _setSelectedTextRange:] + 452
69 UIKitCore 0x1a46af190 -[UITextInputController setSelectedRange:] + 72
70 UIKitCore 0x1a4685498 -[UIFieldEditor _setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText:] + 800
71 UIKitCore 0x1a4684e1c -[UIFieldEditor _setTextInRange:replacementText:andSetCaretSelectionAfterText:] + 204
72 UIKitCore 0x1a4697434 -[UITextField setText:] + 436
73 MyApp-QA 0x100a9e53c -[TextField textField:shouldChangeCharactersInRange:replacementString:] + 311 (TextField.m:311)
74 UIKitCore 0x1a46a3128 -[UITextField _delegateShouldChangeCharactersInTextStorageRange:replacementString:delegateCares:] + 160
75 UIKitCore 0x1a469cee8 -[UITextField keyboardInput:shouldReplaceTextInRange:replacementText:] + 92
76 UIKitCore 0x1a41fc56c -[UIKeyboardImpl acceptAutocorrection:executionContextPassingTIKeyboardCandidate:] + 536
77 UIKitCore 0x1a41ff6d4 -[UIKeyboardImpl acceptPredictiveInput:executionContext:] + 664
78 UIKitCore 0x1a41f5024 -[UIKeyboardImpl inputManagerDidGenerateAutocorrections:executionContext:] + 668
79 UIKitCore 0x1a4221d88 -[UIKeyboardTaskEntry execute:] + 180
80 UIKitCore 0x1a42207b8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 316
81 UIKitCore 0x1a4220b20 -[UIKeyboardTaskQueue performTaskOnMainThread:waitUntilDone:] + 320
82 UIKitCore 0x1a41de6a4 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 156
83 UIKitCore 0x1a41f1d18 -[UIKeyboardImpl selectionDidChange:] + 340
84 UIKitCore 0x1a46af9fc __52-[UITextInputController _coordinateSelectionChange:]_block_invoke + 504
85 UIFoundation 0x1a38f4b64 -[NSTextStorage coordinateReading:] + 56
86 UIKitCore 0x1a46af7dc -[UITextInputController _coordinateSelectionChange:] + 148
87 UIKitCore 0x1a46af364 -[UITextInputController _setSelectedTextRange:] + 452
88 UIKitCore 0x1a46af190 -[UITextInputController setSelectedRange:] + 72
89 UIKitCore 0x1a4685498 -[UIFieldEditor _setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText:] + 800
90 UIKitCore 0x1a4684e1c -[UIFieldEditor _setTextInRange:replacementText:andSetCaretSelectionAfterText:] + 204
91 UIKitCore 0x1a4697434 -[UITextField setText:] + 436
92 MyApp-QA 0x100a9e53c -[TextField textField:shouldChangeCharactersInRange:replacementString:] + 311 (TextField.m:311)
93 UIKitCore 0x1a46a3128 -[UITextField _delegateShouldChangeCharactersInTextStorageRange:replacementString:delegateCares:] + 160
94 UIKitCore 0x1a469cee8 -[UITextField keyboardInput:shouldReplaceTextInRange:replacementText:] + 92
95 UIKitCore 0x1a41fc56c -[UIKeyboardImpl acceptAutocorrection:executionContextPassingTIKeyboardCandidate:] + 536
96 UIKitCore 0x1a41ff6d4 -[UIKeyboardImpl acceptPredictiveInput:executionContext:] + 664
97 UIKitCore 0x1a41f5024 -[UIKeyboardImpl inputManagerDidGenerateAutocorrections:executionContext:] + 668
98 UIKitCore 0x1a4221d88 -[UIKeyboardTaskEntry execute:] + 180
99 UIKitCore 0x1a42207b8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 316
100 UIKitCore 0x1a4220b20 -[UIKeyboardTaskQueue performTaskOnMainThread:waitUntilDone:] + 320
101 UIKitCore 0x1a41de6a4 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 156
102 UIKitCore 0x1a41f1d18 -[UIKeyboardImpl selectionDidChange:] + 340
103 UIKitCore 0x1a46af9fc __52-[UITextInputController _coordinateSelectionChange:]_block_invoke + 504
104 UIFoundation 0x1a38f4b64 -[NSTextStorage coordinateReading:] + 56
105 UIKitCore 0x1a46af7dc -[UITextInputController _coordinateSelectionChange:] + 148
106 UIKitCore 0x1a46af364 -[UITextInputController _setSelectedTextRange:] + 452
107 UIKitCore 0x1a46af190 -[UITextInputController setSelectedRange:] + 72
108 UIKitCore 0x1a4685498 -[UIFieldEditor _setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText:] + 800
109 UIKitCore 0x1a4684e1c -[UIFieldEditor _setTextInRange:replacementText:andSetCaretSelectionAfterText:] + 204
110 UIKitCore 0x1a4697434 -[UITextField setText:] + 436
111 MyApp-QA 0x100a9e53c -[TextField textField:shouldChangeCharactersInRange:replacementString:] + 311 (TextField.m:311)
112 UIKitCore 0x1a46a3128 -[UITextField _delegateShouldChangeCharactersInTextStorageRange:replacementString:delegateCares:] + 160
113 UIKitCore 0x1a469cee8 -[UITextField keyboardInput:shouldReplaceTextInRange:replacementText:] + 92
114 UIKitCore 0x1a41fc56c -[UIKeyboardImpl acceptAutocorrection:executionContextPassingTIKeyboardCandidate:] + 536
115 UIKitCore 0x1a41ff6d4 -[UIKeyboardImpl acceptPredictiveInput:executionContext:] + 664
116 UIKitCore 0x1a41f5024 -[UIKeyboardImpl inputManagerDidGenerateAutocorrections:executionContext:] + 668
117 UIKitCore 0x1a4221d88 -[UIKeyboardTaskEntry execute:] + 180
118 UIKitCore 0x1a42207b8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 316
119 UIKitCore 0x1a4220b20 -[UIKeyboardTaskQueue performTaskOnMainThread:waitUntilDone:] + 320
120 UIKitCore 0x1a41de6a4 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 156
121 UIKitCore 0x1a41f1d18 -[UIKeyboardImpl selectionDidChange:] + 340
122 UIKitCore 0x1a46af9fc __52-[UITextInputController _coordinateSelectionChange:]_block_invoke + 504
123 UIFoundation 0x1a38f4b64 -[NSTextStorage coordinateReading:] + 56
124 UIKitCore 0x1a46af7dc -[UITextInputController _coordinateSelectionChange:] + 148
125 UIKitCore 0x1a46af364 -[UITextInputController _setSelectedTextRange:] + 452
126 UIKitCore 0x1a46af190 -[UITextInputController setSelectedRange:] + 72
127 UIKitCore 0x1a4685498 -[UIFieldEditor _setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText:] + 800
128 UIKitCore 0x1a4684e1c -[UIFieldEditor _setTextInRange:replacementText:andSetCaretSelectionAfterText:] + 204
129 UIKitCore 0x1a4697434 -[UITextField setText:] + 436
130 MyApp-QA 0x100a9e53c -[TextField textField:shouldChangeCharactersInRange:replacementString:] + 311 (TextField.m:311)
131 UIKitCore 0x1a46a3128 -[UITextField _delegateShouldChangeCharactersInTextStorageRange:replacementString:delegateCares:] + 160
132 UIKitCore 0x1a469cee8 -[UITextField keyboardInput:shouldReplaceTextInRange:replacementText:] + 92
133 UIKitCore 0x1a41fc56c -[UIKeyboardImpl acceptAutocorrection:executionContextPassingTIKeyboardCandidate:] + 536
134 UIKitCore 0x1a41ff6d4 -[UIKeyboardImpl acceptPredictiveInput:executionContext:] + 664
135 UIKitCore 0x1a41f5024 -[UIKeyboardImpl inputManagerDidGenerateAutocorrections:executionContext:] + 668
136 UIKitCore 0x1a4221d88 -[UIKeyboardTaskEntry execute:] + 180
137 UIKitCore 0x1a42207b8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 316
138 UIKitCore 0x1a4220b20 -[UIKeyboardTaskQueue performTaskOnMainThread:waitUntilDone:] + 320
139 UIKitCore 0x1a41de6a4 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 156
140 UIKitCore 0x1a41f1d18 -[UIKeyboardImpl selectionDidChange:] + 340
141 UIKitCore 0x1a46af9fc __52-[UITextInputController _coordinateSelectionChange:]_block_invoke + 504
142 UIFoundation 0x1a38f4b64 -[NSTextStorage coordinateReading:] + 56
143 UIKitCore 0x1a46af7dc -[UITextInputController _coordinateSelectionChange:] + 148
144 UIKitCore 0x1a46af364 -[UITextInputController _setSelectedTextRange:] + 452
145 UIKitCore 0x1a46af190 -[UITextInputController setSelectedRange:] + 72
146 UIKitCore 0x1a4685498 -[UIFieldEditor _setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText:] + 800
147 UIKitCore 0x1a4684e1c -[UIFieldEditor _setTextInRange:replacementText:andSetCaretSelectionAfterText:] + 204
148 UIKitCore 0x1a4697434 -[UITextField setText:] + 436
149 MyApp-QA 0x100a9e53c -[TextField textField:shouldChangeCharactersInRange:replacementString:] + 311 (TextField.m:311)
150 UIKitCore 0x1a46a3128 -[UITextField _delegateShouldChangeCharactersInTextStorageRange:replacementString:delegateCares:] + 160
151 UIKitCore 0x1a469cee8 -[UITextField keyboardInput:shouldReplaceTextInRange:replacementText:] + 92
152 UIKitCore 0x1a41fc56c -[UIKeyboardImpl acceptAutocorrection:executionContextPassingTIKeyboardCandidate:] + 536
153 UIKitCore 0x1a41ff6d4 -[UIKeyboardImpl acceptPredictiveInput:executionContext:] + 664
154 UIKitCore 0x1a41f5024 -[UIKeyboardImpl inputManagerDidGenerateAutocorrections:executionContext:] + 668
155 UIKitCore 0x1a4221d88 -[UIKeyboardTaskEntry execute:] + 180
156 UIKitCore 0x1a42207b8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 316
157 UIKitCore 0x1a4220b20 -[UIKeyboardTaskQueue performTaskOnMainThread:waitUntilDone:] + 320
158 UIKitCore 0x1a41de6a4 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 156
159 UIKitCore 0x1a41f1d18 -[UIKeyboardImpl selectionDidChange:] + 340
160 UIKitCore 0x1a46af9fc __52-[UITextInputController _coordinateSelectionChange:]_block_invoke + 504