2012-07-24 55 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

相關問題