Re: debugging a static variable
Re: debugging a static variable
- Subject: Re: debugging a static variable
- From: Sam McCandish <email@hidden>
- Date: Sun, 20 Jun 2004 12:27:42 -0400
I'm not sure, but I think that you should put the static variable
withing the implementation.
Sam
On Sun, 20 Jun 2004 11:12:20 -0400, Koen van der Drift
<email@hidden> wrote:
>
>
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?
_______________________________________________
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.