Tried to obtain the web lock from a thread解决方法之一
来源:互联网 发布:淘宝返现 编辑:程序博客网 时间:2024/04/29 01:31
项目中一个UIViewController内使用异步线程,异步线程未执行完时pop退出此画面,程序crash。控制台打出错误如下:
Tried to obtain the web lock from a thread other than the main thread...
经调查,发现是由于UIViewController的release方法没有在主线程中调用造成的crash,修改方法如下:
- (oneway void) release {
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:NO];
} else {
[super release];
}
}
添加以上代码到UIViewController中,当不在主线程中执行release时,强行回到主线程中执行。
- Tried to obtain the web lock from a thread解决方法之一
- Tried to obtain the web lock from a thread解决方法之一
- 0xab7dcd0: Tried to obtain the web lock from a thread
- Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be
- Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be
- 【解决】iOS开发,更新界面时崩溃,Tried to obtain the web lock from a thread other than the main thread or ……
- the limit to the amount of thread from a process
- ConnectionManager.getConnection() failed to obtain a connection after 11 retries. The exception from
- failed to obtain a cell from its dataSource
- failed to obtain a cell from its dataSource
- reason: 'UITableView failed to obtain a cell from its dataSource'
- failed to obtain a cell from its dataSource 解决方案
- failed to obtain a cell from its dataSource
- TableView异常failed to obtain a cell from its dataSource
- 异常:“严重: The web application [] appears to have started a thread named [Thread-”
- 严重: The web application [] appears to have started a thread named [Thread-
- The web application [] appears to have started a thread named [Thread-
- Could not obtain an exclusive lock to the embedded LDAP data files
- css页面优化
- Jquery ajaxsubmit 上传图片
- APKTool和signapk整合工具及使用教程
- SQL Server 查询优化 索引的结构与分类
- JNI 传递字符串 编码方式处理
- Tried to obtain the web lock from a thread解决方法之一
- URL的井号
- 20个细节改进你的线框图
- JAVA23种设计模式汇总【精简版】
- hdu 1868
- 如何利用doxygen生成pdf文档
- NSDateFormatter转换时间字符串时的时区问题
- 解析可变参数函数的实现原理(printf,scanf)
- 构建ARM嵌入式开发环境