本文共 644 字,大约阅读时间需要 2 分钟。
XXXXX nsthread autoreleased with no pool in place - just leaking
这是一个会经常发生的警告提示。
当调用
[NSThread detachNewThreadSelector:@selector(XXX) toTarget:self withObject:nil];
发起一个多线程的时候会发生这种警告,那么,加上NSAutoreleasePool就可以了,NSAutoreleasePool我的理解是一个自动的进程管理池,当然并不代表着有Java或者AS3的强大GC机制。
[NSThread detachNewThreadSelector:@selector(ooxx) toTarget:self withObject:nil];
- (void)ooxx
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//OOXX,if you like:)
[pool release];
}
关于NSAutoreleasePool可以查看Apple 的官方文档:
另外,需要注意的是,在多进程中要操作主进程的UI是不可以直接操作的,一定要使用:performSelectorOnMainThread
from:http://hi.baidu.com/liaomingsen/blog/item/d9b71a639b91677b0d33faeb.html
转载地址:https://blog.csdn.net/h3c4lenovo/article/details/8641011 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!