2012-07-24 58 views
1

我的应用程序是ARC启用的。*** __NSAutoreleaseNoPool():NSPathStore2类的对象0x926d620自动释放,没有到位池 - 只是泄漏

在应用程序委托我已经写了代码

[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]; 
} 

任何人都可以请向我解释,在这种情况下发生了什么。

回答

3

它说你没有自动释放池来管理自动释放对象。 默认情况下,主线程将有其自动释放池。 当你创建一个线程时,你必须自己创建一个自动释放池。

+0

我在ipad 4.3模拟器中发现了这个问题。在5.0和5.1中没有问题。 – 2012-07-24 04:18:30

+0

有趣。让我们来看看IOS中添加了什么来消除警告。 – Vignesh 2012-07-24 04:47:00

相关问题