I ve some doubts regarding dealloc function in iPhone program. Is it required to give [self.object_name release] or [object_name release] is ok?.. I ve this strange problem in my dealloc function is like this.
-(void) dealloc {
[self.listOfDates release];
[self.listOfDescriptions release];
[super dealloc];
}
但方案坠毁给EXEC_BAD_ACCESS。 这里,两种物体都是为班级分配全功能的NSMutableArray。 同一职能没有自谋职业的罚款,即:
-(void) dealloc {
[listOfDates release];
[listOfDescription release];
[super dealloc];
}
在这方面,我如何宣布财产
@property (nonatomic,retain) NSMutableArray *listOfDates;
@property (nonatomic,retain) NSMutableArray *listOfDescription;
在执行档案中,我对这块材料进行了分析,在单项功能中,我已将这些变数如此分配。
self.listOfDates = [[NSMutableArray alloc] init];
self.listOfDescription = [[NSMutableArray alloc] init];
因此,必须自给吗? 我在这里失踪了什么?
当我取消了我用来复制NSMutable Arrays的 mu变功能时,问题得到解决。
-(id)initWithDate:(NSMutableArray *)dates andDescription:(NSMutableArray*)descriptions
{
if(self = [super initWithNibName:@"DateDescriptionControl" bundle:nil])
{
self.listOfDates = [[NSMutableArray alloc] init];
self.listOfDescription = [[NSMutableArray alloc] init];
self.listOfDates = [dates mutableCopy];
self.listOfDescription = [description mutableCopy];
}
return self;
}
mu除后 制片现在没有扔下EXEC_BAD_ACCESS。 因此,在我犯了错误的地方,我仍然能够说出: