Application crash when enter text in uitextfiled and getting error like: _NSLayoutTreeLineFragmentRectForGlyphAtIndex invalid glyph index 7. Any help would be much appreciated..
The __NSLayoutTreeLineFragmentRectForGlyphAtIndex invalid glyph index
stuff does (to the best of my knowledge) not cause the crash.
But there seems to be an underlying cause for both the crash and the invalid glyph. These kinds of errors pop up in places like custom NSTextStorage
subclasses's -processEditing
, when your perform changes to the text storage while layout is in progress and/or vice versa.
Since the OP didn't offer more details, here's a suggested list to find instead of solving the problem. After every step, try to run the program and look for crashes:
UITextField
subclasses themselves, and use system default components instead. This should not crash anymore.NSTextStorageDelegate
and friends. Now on to component subclasses; put the subclasses back into operation in this order, derived from the chain of responsibility in the layout process, one by one:
NSGlyphGenerator
subclasses, if any. They are way down the command chain. If nothing happens, use the system default again for now.NSTypesetter
subclasses, put it in, then toggle it off again.NSLayoutManager
subclasses, if any. This stuff is still further down the command chain.NSTextStorage
subclass. Text storages are high up the command chain and may have multiple places where they can break.Then try combinations, starting at the bottom again, and try as many combos as you need until the app breaks.
Once you find the exact call that causes the crash, open a new question :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With