gpt4 book ai didi

swift - 当键盘存在时未捕获 NSException

转载 作者:行者123 更新时间:2023-11-30 12:41:00 27 4
gpt4 key购买 nike

我有一个基本的登录页面,它采用两个值(用户名和密码),这些详细信息被传递到我的服务器,我在服务器上使用 PHP 解析结果并返回 JSON 数组。

一切正常;我可以正确登录,错误登录时会出现正确的错误警报等。但是,每当我尝试登录应用程序时,键盘未最小化:

libc++abi.dylib: terminating with uncaught exception of type NSException

我希望有人能知道这是为什么?我的整个错误线程如下:

libsystem_kernel.dylib`__pthread_kill:
0x18bb6700c <+0>: movz x16, #0x148
0x18bb67010 <+4>: svc #0x80
->0x18bb67014 <+8>: b.lo 0x18bb6702c ; <+32>
0x18bb67018 <+12>: stp x29, x30, [sp, #-16]!
0x18bb6701c <+16>: mov x29, sp
0x18bb67020 <+20>: bl 0x18bb4a7d0 ; cerror_nocancel
0x18bb67024 <+24>: mov sp, x29
0x18bb67028 <+28>: ldp x29, x30, [sp], #16
0x18bb6702c <+32>: ret

I have attached a screenshot of my app for you to get a clearer pic of what I mean that the keyboard is not minimized

Complete debugger output

最佳答案

异常是告诉您不要在后台线程上执行 UI 操作。您需要将任何涉及 UI 的代码封装到主线程的调度中:

DispatchQueue.main.async {
// set up and present alert
}

通常,每当您使用以 UI 开头或名称中包含 View 的类时,您都需要位于主线程上。

关于swift - 当键盘存在时未捕获 NSException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42217681/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com