错误:bool _WebTryThreadLock(bool),对于 UIAlertView

发布于 2024-12-11 14:11:29 字数 321 浏览 0 评论 0原文

**bool _WebTryThreadLock(bool),** 0x4c7a7e0: 尝试从主线程或 Web 线程以外的线程获取 Web 锁。这可能是从辅助线程调用 UIKit 的结果。现在崩溃...

当我这样做时,我收到上述错误,

[alertForSavingText解雇WithClickedButtonIndex:ALERT_CANCEL动画:YES];

这是我的自定义警报,里面有文本字段。仅当我将应用程序从后台切换到前台时才会出现错误,当自定义警报文本字段和中存在某些文本时也会发生错误。键盘也可见。

任何建议。

**bool _WebTryThreadLock(bool),** 0x4c7a7e0: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...

I m getting an above error when i do this,

[alertForSavingText dismissWithClickedButtonIndex:ALERT_CANCEL animated:YES];

This is my custom alert with textField inside. Error comes only when I switch the application from background to foreground also it occurs when there is some text present in custom alert textField & keyboard is also visible.

Any suggestion.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鸢与 2024-12-18 14:11:29

请检查当前线程是否为主线程。如果它是主线程,请按照您给出的那样将其关闭。否则,如果是辅助线程,则通过调用 performSelectorInMainThread:... 方法关闭主线程中的警报视图

Please check whether the current thread is main thread. If it is main thread, dismiss it as you have given. Else, if it is secondary thread, dismiss the alert view in main thread by calling performSelectorInMainThread:... method

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文