78NSMutableArray & retain
A beginner’s mistake:
*.h
@interface * {
NSMutableDictionary *myDict;
}
@property (nonatomic, retain) NSMutableDictionary *myDict;
*.m
@synthesize myDict;
...
myDict = [[NSMutableDictionary dictionaryWithObjectsAndKeys: ..., ..., nil] retain];
If NSMutableDictionary
is created with NSMutableDictionary dictionaryWithObjectsAndKeys
, and it should be retained, it has to been sent a retain
message explicitly.
No alloc, no init, no retain…