长按键盘时 TextField 显示 -[UIWindow endDisablingInterfaceAutorotationAnimated:] 错误 (SwiftUI)

Posted

技术标签:

【中文标题】长按键盘时 TextField 显示 -[UIWindow endDisablingInterfaceAutorotationAnimated:] 错误 (SwiftUI)【英文标题】:TextField displays -[UIWindow endDisablingInterfaceAutorotationAnimated:] error when keyboard is long pressed (SwiftUI) 【发布时间】:2020-03-10 02:04:00 【问题描述】:

每当我长按 ios 键盘中的某个键以显示备用键时,我都会收到以下错误:

2020-03-09 21:44:42.669194-0400 TestProject[10220:731641] 
-[UIWindow endDisablingInterfaceAutorotationAnimated:] called on 
<UIRemoteKeyboardWindow: 0x7ff98204fc00; frame = (0 0; 320 568); 
opaque = NO; autoresize = W+H; layer = <UIWindowLayer: 0x6000020980e0>> 
without matching -beginDisablingInterfaceAutorotation. Ignoring.

这甚至发生在一个新项目上。这是我的代码:

import SwiftUI

struct ContentView: View 
    @State var testing: String = ""
    var body: some View 
        TextField("Hello, World!", text: $testing)
    

我尝试在线搜索解决方案,但每个人在尝试动态隐藏键盘时都会遇到这个问题,这不是我的情况。有谁知道我为什么会收到这个错误?

附:我正在开发 XCode 版本 11.3.1 (11C504)。

【问题讨论】:

【参考方案1】:

这绝对不是错误。 这只是一个抛出到控制台的调试消息,您可以放心地忽略它。

【讨论】:

以上是关于长按键盘时 TextField 显示 -[UIWindow endDisablingInterfaceAutorotationAnimated:] 错误 (SwiftUI)的主要内容,如果未能解决你的问题,请参考以下文章

Qt TextField 在 Android 设备上启动时未调用键盘

如何通过长按制作textField或UILabel,使其可以“复制”,但不能编辑

颤振检测键盘隐藏动画的结束

Android 11.0 修复长按关机键弹出框框时,按键盘任意键屏幕顶部状态栏会显示出来其他阴影

如何在使用 inputView 后显示键盘

iOS - 更改为不同的 TextField 时保持 TextField 状态的输入键盘