iOS9 dismissing keyboard causes crash

孤者浪人 提交于 2019-12-22 17:38:47

问题


When i try to run my app at iOS 9.1 simulator i have a crash

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UIInputWindowController: 0x7ff82b036e00>)

Crash happens in main function.

Crash happens when i try to dismiss the keyboard with

[self.username resignFirstResponder];

Also when you self.view.userInteractionEnabled = false;

I've read View appear with modal view animation instead of show (push) animation with similar issue - but i have only 1 root navigation controller

Any ideas?

iOS 9 only bug


回答1:


Issue was with UIViewController category

dealloc method was overridden to clean up notification callbacks.

And it caused a crash on iOS 9. Probably due to the fact [super dealloc] wasn't called (due to ARC restrictions)

Solution - remove dealloc method from category to the UIViewController subclasses



来源:https://stackoverflow.com/questions/32552986/ios9-dismissing-keyboard-causes-crash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!