当UITextField成为Touch ID完成块(iOS 10)中的第一个响应者时,未显示iOS键盘(UIRemoteKeyboardWindow内部) [英] iOS Keyboard (inside UIRemoteKeyboardWindow) is Not Shown When UITextField Becomes First Responder in Touch ID Completion Block (iOS 10)

查看:379
本文介绍了当UITextField成为Touch ID完成块(iOS 10)中的第一个响应者时,未显示iOS键盘(UIRemoteKeyboardWindow内部)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在我的应用程序中发现了一个问题,似乎只出现在iOS 10中,当编程触发文本字段成为完成处理程序内的第一响应者时,系统键盘不显示 - 特别是完成处理程序I从Touch ID尝试回来。



这个问题的一个疯狂部分是,即使没有显示键盘,iPhone上键盘通常所在的区域仍然会响应触摸输入,就好像用户正在键盘上打字!



在对问题进行大量调查和调试之后,我偶然发现隐藏属性设置为 YES UIRemoteKeyboardWindow 在文本字段上调用> becomeFirstResponder 。在我调出键盘的其他情况下,隐藏属性的值设置为



还有其他人在iOS 10中遇到此问题吗?如果是这样,有人找到了解决方案吗?我尝试在窗口实例上手动将隐藏值设置为 YES ,但这对它没有影响。我现在非常关注稻草。



附件:

这是窗口的输出UIApplication 实例,当文本字段成为Touch ID完成处理程序之外的第一响应者时(密切注意 UIRemoteKeyboardWindow ):





UITextField 成为Touch ID处理程序中的第一个响应者...





第一次更新



所以我没有考虑 becomeFirstResponder 正在主线程上完成有人指出,但不幸的是,它没有解决问题 - 但是,我确实做了一些额外的发现。 隐藏窗口问题似乎源于在发出<$ c $后立即输出 UIApplication 实例窗口的详细信息c> becomeFirstResponder 操作。在这之后,我在 UITextField 编辑回调上设置断点并继续与键盘交互(这是不可见的) - 当我输出窗口细节时,它不会似乎隐藏的属性设置为 YES (这可能会排除该属性被设置为问题的原因),但我仍然有一个隐形键盘!我开始调试视图层次结构,下面是我查看键盘窗口时的截图:





希望你们能看到什么我在这里发现的是钥匙存在,但似乎有一些白色的视图阻挡了他们的视线。问题是,我甚至没有在我的应用程序屏幕上看到那些白色视图。我只是看到键盘正常位于键盘后面的位置。

解决方案

作为临时解决方法,请致电在延迟修复此问题之后,成为第一个响应者,对 hacky 解决方案不满意。


I've recently discovered a problem in my app that only seems to occur in iOS 10 where the system keyboard does not display when programmatically triggering a text field to become first responder inside of a completion handler -- specifically the completion handler I get back from a Touch ID attempt.

The crazy part of this issue is, even though the keyboard is not shown, the area on the iPhone where the keyboard normally would be is still responding to touch inputs as if the user is typing on the keyboard!

After doing a lot of investigation and debugging into the issue, I stumbled across the fact that the hidden property is set to YES on the private UIRemoteKeyboardWindow that gets created after becomeFirstResponder is invoked on the text field. In other situations where I bring up the keyboard, the value of that hidden property is set to NO.

Has anybody else run into this problem in iOS 10? If so, anybody found a solution to this? I tried manually setting the hidden value to YES on the window instance but that had no effect on it. I'm pretty much grasping at straws at this point.

Attachments:
Here's the output of the windows from the UIApplication instance when the text field becomes first responder outside of the Touch ID completion handler (pay close attention to UIRemoteKeyboardWindow):

And when the UITextField becomes the first responder inside the Touch ID handler...

First Update

So I did not consider the becomeFirstResponder being done on the main thread before that some have pointed out, but unfortunately, it did not resolve the issue -- however, I did make some additional discoveries. The hidden window issue seems to stem from outputting the details of the UIApplication instance's windows immediately after issuing the becomeFirstResponder action. After doing that, I set a breakpoint on the UITextField editing callback and proceed to interact with the keyboard (that is invisible) -- and when I output the window details, it doesn't seem like the hidden property is ever set to YES (which can possibly rule out that property being set as the cause of the issue), but I still have an invisible keyboard! I started debugging the view hierarchy and below is a screenshot of what it looks like when I examine the keyboard window:

Hopefully you guys can see what I discovered here which is that the keys are present but there appears to be some white view blocking them from sight. The thing is, I don't even see those white views on my app screen. I just see what normally sits behind the keyboard when it's present.

解决方案

As a temporary workaround, call becomeFirstResponder after a delay fixed this, however, not happy with the hacky solution.

这篇关于当UITextField成为Touch ID完成块(iOS 10)中的第一个响应者时,未显示iOS键盘(UIRemoteKeyboardWindow内部)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆