2011-08-19 101 views
0

我從xib載入我的視圖。當嘗試釋放它的消息崩潰:Dealloc上的應用程序崩潰

Designer項目(72849,0xa08c0540)的malloc:*錯誤對象 0x4b06000:被釋放的指針沒有被分配 *設置malloc_error_break調試當前斷點語言: 汽車;目前Objective-C的

這是我實現:

@interface ACLine : UIView { 

    NSMutableArray *chevrons; 
} 

- (void)addChevron:(ACChevron *)aChevron; 
- (void)addChevron:(ACChevron *)aChevron atIndex:(NSInteger)anIndex; 

- (void)removeAllChevrons; 
- (void)removeChevron:(ACChevron *)aChevron; 
- (void)removeChevronAtIndex:(NSInteger)anIndex; 

- (void)update; 

@property (nonatomic, retain) NSMutableArray *chevrons; 

@end 

@implementation ACLine 

@synthesize chevrons; 

- (void)awakeFromNib { 

    chevrons = [[NSMutableArray alloc] init]; 
} 

- (void)dealloc { 
    self.chevrons = nil; 
    [super dealloc]; it crashes here 
} 

請解決問題有所幫助。 謝謝。

回答

0

嘗試自動釋放V形圖案。

chevrons = [[[NSMutableArray alloc] init] autorelease]; 

希望這可能有所幫助。

0

您是否嘗試添加「[super awakeFromNib];」之後「 - (void)awakeFromNib {」?

+0

是的,同樣的問題 – Sergio