I don’t know if I’m completely brainfarting today, or what. But basically I’m trying to initialize a NSMutableDictionary to be used. I have it as a property:
@property (nonatomic, retain) NSMutableDictionary *baseViewDictionary;
in the .m file:
@synthesize baseViewDictionary;
// in the init method:
NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] initWithCapacity:0];
self.baseViewDictionary = tempDict;
[self.baseViewDictionary setObject:@"test" forKey:[NSNumber numberWithInteger:0]];
[tempDict release];
I thought this was a pattern to be used to initialize a NSMutableDictionary. Unfortunately, my self.baseViewDictionary never gets set. My tempDict has 1 key/value pair I see in the debugger, but my self.baseViewDictionary has 0x0000000. So it’s like
self.baseViewDictionary = tempDict;
never gets run. When I step into that line of code, it jumps to the @synthesize baseViewDictoinary, then returns back to the self.baseViewDictionary=tempDict line.
Here’s the picture of the debugger after setObject@"test" gets run.

Your pattern is correct.
The initialization is done right, no memory leak as you release the dictionary after the assignation to the property, which retains it.
Are your sure your
initmethod is correct?I mean, calling
self = [ super init ](not==), doing your stuff after this, and returningself?It may seem obvious, but as your instance variable seems to be
nil,selfmay benilalso…