0

我試圖跟蹤EXC壞訪問。我已經運行了NSZombie啓用的儀器,當應用程序崩潰時,我得到這個錯誤日誌。有一個UIView會自動釋放四次,但在自動釋放池被排空之前,它只有一個引用計數3,所以int以-1引用計數結束。Undestanding NSZombie登錄

我不發送任何自動釋放的消息我自己,所以我怎麼能解決這個問題?

 

# Category Event Type RefCt Timestamp Address Size Responsible Library Responsible Caller 
0 UITextView Malloc 1 00:09.478.888 0x80c2920 448 UIKit -[UIRuntimeConnection initWithCoder:] 
1 UITextView Retain 2 00:09.492.814 0x80c2920 0 UIKit -[UITextView resignFirstResponder] 
2 UITextView Autorelease  00:09.492.822 0x80c2920 0 UIKit -[UITextView resignFirstResponder] 
3 UITextView Retain 3 00:09.494.396 0x80c2920 0 UIKit -[UIRuntimeConnection initWithCoder:] 
4 UITextView Retain 4 00:09.494.400 0x80c2920 0 Foundation -[NSKeyedUnarchiver _replaceObject:withObject:] 
5 UITextView Release 3 00:09.494.403 0x80c2920 0 UIKit -[UIRuntimeConnection initWithCoder:] 
6 UITextView Retain 4 00:09.494.407 0x80c2920 0 UIKit -[UIRuntimeConnection initWithCoder:] 
7 UITextView Release 3 00:09.494.448 0x80c2920 0 UIKit -[UIRuntimeConnection initWithCoder:] 
8 UITextView Autorelease  00:09.494.845 0x80c2920 0 UIKit -[UIRuntimeConnection initWithCoder:] 
9 UITextView Retain 4 00:09.494.848 0x80c2920 0 UIKit -[UIRuntimeConnection initWithCoder:] 
10 UITextView Retain 5 00:09.495.215 0x80c2920 0 Foundation -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] 
11 UITextView Retain 6 00:09.495.230 0x80c2920 0 Foundation -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] 
12 UITextView Release 5 00:09.495.241 0x80c2920 0 Foundation -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] 
13 UITextView Retain 6 00:09.495.255 0x80c2920 0 Foundation -[NSArray(NSArray) initWithCoder:] 
14 UITextView Release 5 00:09.495.277 0x80c2920 0 UIKit -[UIView initWithCoder:] 
15 UITextView Retain 6 00:09.495.325 0x80c2920 0 UIKit -[UIView(Internal) _addSubview:positioned:relativeTo:] 
16 UITextView Release 5 00:09.499.036 0x80c2920 0 UIKit -[UINib instantiateWithOwner:options:] 
17 UITextView Retain 6 00:09.499.306 0x80c2920 0 Foundation -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] 
18 UITextView Retain 7 00:09.499.325 0x80c2920 0 Foundation -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] 
19 UITextView Release 6 00:09.499.336 0x80c2920 0 Foundation -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] 
20 UITextView Retain 7 00:09.499.358 0x80c2920 0 Foundation -[NSArray(NSArray) initWithCoder:] 
21 UITextView Release 6 00:09.499.385 0x80c2920 0 UIKit -[UINib instantiateWithOwner:options:] 
22 UITextView Retain 7 00:09.499.511 0x80c2920 0 Proyecto3 -[EventoDetailViewControllerClass setNombreTextView:] 
23 UITextView Release 6 00:09.499.681 0x80c2920 0 Foundation -[NSKeyedUnarchiver dealloc] 
24 UITextView Release 5 00:09.499.747 0x80c2920 0 Foundation -[NSKeyedUnarchiver dealloc] 
25 UITextView Release 4 00:09.499.762 0x80c2920 0 Foundation -[NSKeyedUnarchiver dealloc] 
26 UITextView Release 3 00:09.499.817 0x80c2920 0 Foundation -[NSKeyedUnarchiver dealloc] 
27 UITextView Release 2 00:09.499.880 0x80c2920 0 UIKit -[UIRuntimeConnection dealloc] 
28 UITextView Retain 3 00:09.534.891 0x80c2920 0 QuartzCore -[CALayer layoutSublayers] 
29 UITextView Release 2 00:09.534.895 0x80c2920 0 QuartzCore CALayerLayoutIfNeeded 
30 UITextView Retain 3 00:09.607.480 0x80c2920 0 UIKit -[UIView(Hierarchy) subviews] 
31 UITextView Retain 4 00:09.607.947 0x80c2920 0 UIKit -[UITouch(UITouchInternal) setView:] 
32 UITextView Retain 5 00:09.607.951 0x80c2920 0 UIKit -[UITouch(UITouchInternal) setGestureView:] 
33 UITextView Retain 6 00:09.608.655 0x80c2920 0 UIKit -[UITouch view] 
34 UITextView Autorelease  00:09.608.658 0x80c2920 0 UIKit -[UITouchesEvent _clearViewForTouch:] 
35 UITextView Release 5 00:09.608.661 0x80c2920 0 UIKit -[UITouch(UITouchInternal) setView:] 
36 UITextView Release 4 00:09.608.666 0x80c2920 0 UIKit -[UITouch(UITouchInternal) setGestureView:] 
37 UITextView Release 3 00:09.608.807 0x80c2920 0 Foundation -[NSAutoreleasePool release] 
38 UITextView Retain 4 00:09.609.307 0x80c2920 0 UIKit -[UITouch(UITouchInternal) setView:] 
39 UITextView Retain 5 00:09.609.311 0x80c2920 0 UIKit -[UITouch(UITouchInternal) setGestureView:] 
40 UITextView Retain 6 00:09.725.677 0x80c2920 0 UIKit -[UITouch view] 
41 UITextView Autorelease  00:09.725.680 0x80c2920 0 UIKit -[UITouchesEvent _clearViewForTouch:] 
42 UITextView Release 5 00:09.725.684 0x80c2920 0 UIKit -[UITouch(UITouchInternal) setView:] 
43 UITextView Release 4 00:09.725.688 0x80c2920 0 UIKit -[UITouch(UITouchInternal) setGestureView:] 
44 UITextView Release 3 00:09.725.839 0x80c2920 0 Foundation -[NSAutoreleasePool release] 
45 UITextView Zombie -1 00:11.383.459 0x80c2920 0 UIKit -[UIView(Internal) _invalidateSubviewCache] 
 

回答

1

當使用Instruments來分析泄漏時,最好忽略顯示歸因於Apple庫的泄漏。要調查的泄漏是那些顯示來源於您的應用程序的代碼。當池排出被自動釋放

對象被釋放。如果您還沒有創建自己發佈的任何自己的對象,那麼唯一的自動發佈的對象必須是Apple自己的對象,例如。 [NSString string]

我假定你已經運行分析和解決突出問題,所有?如果不是,那就是第一步。

接下來,看看那裏的EXC_BAD_ACCESS發生線路。它*可能*提供關於違規對象的線索。有可能是 - 或其他 - 對象被過早釋放,或者您沒有充分保留它們。

發生這種情況時,在某些點上運行時會收回他們。嘗試訪問它們會導致可怕的EXC_BAD_ACCESS

這裏的鏈接婁佛朗哥的解釋上EXC_BAD_ACCESS以及如何追查:

Understanding EXC_BAD_ACCESS

+0

雖然我終於設法得到它自己,我紀念你的答案來解決,因爲分析是什麼導致我得到殭屍。 –