• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
debugging a static variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: debugging a static variable
      • From: Koen van der Drift <email@hidden>
    • Re: debugging a static variable
      • From: j o a r <email@hidden>
    • Re: debugging a static variable
      • From: Sam McCandish <email@hidden>
  • Prev by Date: Re: Debugger calling string methods on a window
  • Next by Date: Re: debugging a static variable
  • Previous by thread: Re: Debugger calling string methods on a window
  • Next by thread: Re: debugging a static variable
  • Index(es):
    • Date
    • Thread