解决autoreleased with no pool in place


问题:
NSCFString autoreleased with no pool in place - just leaking

解决方案
在你使用非主线程而又使用了autorelease方法就会出现这样的问题
可以这样修改:
例如你原来是这样写的:
- (void)someMethodPerformedInOtherThread
{
    // code (for example: [UIColor redColor])
}
改为:
- (void)someMethodPerformedInOtherThread
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     // code (for example: [UIColor redColor])
    [pool release];
}

猜你喜欢

转载自longquan.iteye.com/blog/1648807