Custom iPad keyboard backspace method last character crash
- by isaaclimdc
I'm making a custom UI iPad keyboard app, and I'm doing something similar to this post for the backspace method: custom backspace button crashes iPhone app
However, the app will always crash when I "backspace" for the last character in the UITextView. I know -substringToIndex won't work for an empty string, but I tried using a temporary mutable string then using -deleteCharactersInRange, and that crashed it too.
I'm guessing the crash is due to me manually setting the -selectedRange property for the text view after deleting a character? But even if I do:
textView.selectedRange = NSMakeRange(0, 0);
the app will crash. Any ideas?