Code Block *** Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray replaceObjectsInRange:withObject:length:: Out of bounds'
reproducing this bug is really easy. Create a new project. add a textfield. set delegate.
Code Block extension ViewController: UITextFieldDelegate { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { let str = (textField.text! + string) if str.count <= 30 { return true } return false } }
run the app in ipad and type "abcdef" and copy the text. and paste it 3 or 4 times till limit reached (30 char). And tap undo. CRASHED
Please provide a solution for this. Thanks