2011-08-19 102 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