I believe I've come across a bug in iOS 7. When a UITextView is contained in a modal view, having its inputview property changed from a custom view to nil (in order to bring back the system keyboard) will cause the app to crash after the modal view is dismissed.
This crash only occurs under iOS 7. Previous versions of iOS did not exhibit this problem.
I wrote a small sample app to demonstrate the problem. Compile the launch the app and do the following:
- Tap the button "Show TextView". This will present a modal ViewController containing a UITextView and three buttons.
- Tap the button "Set inputview to emptyView". This will create an empty UIView and assign it to the inputview property of the UITextView.
- Tap the button "Set inputview to nil". This will assign nil to the inputview property of UITextView. This is done in order to show the system keyboard.
- Tap the button "Dismiss ViewController". This will dismiss the view controller to return to the original view controller.
As soon as the ViewController is dismissed, the app crashes immediately. The crash log sometimes, but not always, refers to an unrecognized selector being sent to an object. The object's type is different every time the crash is reproduced.
Has anyone else come across this sort of bug?