debugging a static variable
debugging a static variable
- Subject: debugging a static variable
- From: Koen van der Drift <email@hidden>
- Date: Sun, 20 Jun 2004 11:12:20 -0400
Hi,
I have declared a static variable that can be used by all instances of
the same class:
static NSMutableDictionary *myDict = nil;
@implementation MyObject
- (id)init
{
if ( self = [super init] )
{
if ( ! myDict )
{
id aFile = [[NSBundle mainBundle]
pathForResource:@"modifications" ofType:@"plist"];
NSLog(@"aFile is %@", aFile);
[self setMyDict: [[NSMutableDictionary alloc]
initWithContentsOfFile: aFile]];
}
}
}
What happens is that every time init gets called, myDict is nil, so the
part in brackets is called every time. I know that the dicttionary is
created with the right contents, because [self setMyDict: ] gets
called. But apparently it is not preserved. I tried to debug this, but
I do not see myDict listed in the debugger's variable pane. Is there a
way that I can track static variables in the debugger?
thanks,
- Koen.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.