试图从主线程或Web线程之外的线程获取Web锁定。现在崩溃 [英] Tried to obtain the web lock from a thread other than the main thread or the web thread. Crashing now

查看:407
本文介绍了试图从主线程或Web线程之外的线程获取Web锁定。现在崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



我收到此错误。



今天我第一次发现这个错误,显示密码对话框,alertview显示在顶部,直到viewWillAppear视图。这一切似乎都很好,当我开发这一天的另一天。不确定为什么线程锁已经丢失,以及如何实现它?

解决方案

 这可能是从辅助线程调用UIKit的结果。正在崩溃... 

...而且我看到的只是你做。您正在从主线程以外的线程调用 [alertProgress dismissWithClickedButtonIndex:0 animated:YES]; ,这是一个UIKit方法,不允许。 / p>

如果您不能使用GCD,可以通过非常直接回调主线程,请查看 DDFoundation



您的代码在这种情况下只会改变做;

  [[alertProgress dd_invokeOnMainThread] dismissWithClickedButtonIndex:0 
animated:YES];


bool _WebTryThreadLock(bool), 0x8053ce0: 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 this error.

Today I've discovered this error for the first time, the password dialog is shown and the alertview is showing on top, which shouldn't occur till viewWillAppear when the view is shown. This all seemed to work fine when I developed this the other day. Not sure why the thread lock has been lost and how and were to implement it?

解决方案

This may be a result of calling to UIKit from a secondary thread. Crashing now...

...and as far as I can see that's just what you're doing. You're calling [alertProgress dismissWithClickedButtonIndex:0 animated:YES];, a UIKit method, from a thread other than your main thread(s), which is not allowed.

For a very straight forward way to call back to the main thread if you can't use GCD, take a look at DDFoundation.

Your code would in that case only change to do;

[[alertProgress dd_invokeOnMainThread] dismissWithClickedButtonIndex:0 
                                       animated:YES]; 

这篇关于试图从主线程或Web线程之外的线程获取Web锁定。现在崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆