美文网首页
[iOS] iOS9 收起键盘崩溃

[iOS] iOS9 收起键盘崩溃

作者: 世上无南西 | 来源:发表于2020-01-13 16:19 被阅读0次

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UIInputWindowController: >)
这个闪退之后 要么停到main,要么停到sendEvent,反正就是让你无从下手,其实这个问题超级简单而且复现必崩溃。
问题就是工程中有UIViewController的分类(Category),然后你在分类中实现了dealloc方法,ARC不支持这种管理,就崩溃了。你试试随便写个demo,只要在工程新建一个UIViewController的Category并写一个空的dealloc方法,就能完美复现。

解决方法就是:

Category中删除dealloc方法,就没问题了。你如果需要处理一些和释放相关的,放到其他地方,动动小脑袋你肯定能想到不用dealloc也能实现的方法。

参考:https://stackoverflow.com/questions/32552986/ios9-dismissing-keyboard-causes-crash

相关文章

网友评论

      本文标题:[iOS] iOS9 收起键盘崩溃

      本文链接:https://www.haomeiwen.com/subject/urqnactx.html