iOS9关闭键盘导致崩溃

iOS9关闭键盘导致崩溃

本文介绍了iOS9关闭键盘导致崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在iOS 9.1模拟器上运行我的应用程序时有一个崩溃

 尝试加载视图的视图控制器,并且可能导致未定义的行为(< UIInputWindowController:0x7ff82b036e00>)






$ b

当我尝试使用

关闭键盘时发生崩溃。 [self.username resignFirstResponder];

此外,当您 self.view.userInteractionEnabled = false;



我读过与类似的问题 - 但我只有一个根导航控制器



任何想法?



iOS 9只有错误

解决方案

问题是使用UIViewController类别



dealloc方法被覆盖以清除通知回调。



可能是由于[super dealloc]没有被调用(由于ARC限制)



解决方案 - 从类别中移除dealloc方法到UIViewController子类


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

解决方案

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

这篇关于iOS9关闭键盘导致崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 21:45