我的应用程序是启用 ARC 的。
在应用程序委托(delegate)中,我编写了一个代码
[self performSelectorInBackground:@selector(initializeAnimationImageArrays) withObject:nil];
我的方法是
- (void)initializeAnimationImageArrays
{
NSArray *animationArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
nil];
}
我看到了一些错误消息,如下所示
*** __NSAutoreleaseNoPool(): Object 0x926d620 of class NSPathStore2 autoreleased with no pool in place - just leaking
我通过修改如下方法解决了这个问题。
@autoreleasepool
{
NSArray *animationArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
nil];
}
谁能向我解释一下,在这种情况下发生了什么。
最佳答案
它说您没有自动释放池来管理自动释放的对象。
默认情况下,主线程将拥有其自动释放池。
当你创建一个线程时,你必须自己创建一个自动释放池。
关于iphone - *** __NSAutoreleaseNoPool() : Object 0x926d620 of class NSPathStore2 autoreleased with no pool in place - just leaking,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11623999/