错误:bool _WebTryThreadLock(bool),对于 UIAlertView
**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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请检查当前线程是否为主线程。如果它是主线程,请按照您给出的那样将其关闭。否则,如果是辅助线程,则通过调用
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