Hi all,
I have a class wich is initialized like this.
// myclass.h
@property(nonatomic,retain) NSMutableArray *daysOfWeek; // this is in .h file
// myclass.m
@synthesize daysOfWeek;
-(id)init {
if(self=[super init]) {
// initialize days of week
self.daysOfWeek = [NSMutableArray arrayWithCapacity:0];
}
return self;
}
however later during application lifecycle, seems that daysOfWeek get freed. If I add retain in init method:
self.daysOfWeek = [[NSMutableArray arrayWithCapacity:0] retain];
then everything works as expected, and I can add and retrieve object from daysOfWeek. I tought that synthesize would retain the daysOfWeek, what am I missing here ?
thanks