我目前正在从事一个相当大的项目,该项目跨越许多不同的文件并使用SwiftData。它使用具有自定义Tabar的TabView的主视图。这已经有效了。现在,其中一个屏幕具有文本字段。当我开始开发此屏幕时,我遇到了以下错误消息。

问题描述 投票:0回答:1
想到这个错误可能是由我使用的动画造成的,我将它们一个接一个地删除。但是,问题保持不变。然后,我开始隔离此问题的来源(原来是Textfield),消除了过程中的所有其他可能性(删除了与SwiftData,样式等的连接),我在我的混乱中,我写了以下快速简便的视图

import SwiftUI struct ContentView: View { @State private var username: String = "" var body: some View { VStack { TextField("Username", text: $username) Text(username) } } }

将其放入我的应用程序的根源中。

import SwiftUI import SwiftData @main struct K_TutorApp: App { var body: some Scene { WindowGroup { ContentView() } } }

,但是仍然丢下同样的错误!!!

我甚至在手机上卸载了该应用程序(我将手机用作模拟器),并且错误仍然存在。

没有人知道我可以尝试解决这个问题 /为什么会发生此错误?

如果您有点垃圾邮件,您可能会有更多日志:

Can't find or decode reasons Failed to get or decode unavailable reasons Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem. If you want to see the backtrace, please set CG_NUMERICS_SHOW_BACKTRACE environmental variable. AVHapticClient.mm:446 -[AVHapticClient finish:]: ERROR: Player was not running - bailing with error Error Domain=com.apple.CoreHaptics Code=-4805 "(null)" for client 0x1000ba5 Gesture: System gesture gate timed out.
在某些时候,我明确地提到了这是一个内部错误。

,但是,该错误仅在启用调试模式时才发生。杀死您的应用程序并从应用程序图标再次运行,它应该点头发生。因此,即使在开发和测试中很烦人,我也建议忽略此问题。

发现

swift swiftui textfield
1个回答
0
投票

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.