Hi,
I've read somewhere that Objective-C doesn't have class level attributes, but that the same can be achieved by declaring something like this (before the class interface):
static NSInteger initCount;
I'm initializing the variable to zero with the initialize method:
// interface
+ (void) initialize;
// implementation
+ (void) initialize {
initCount = 0;
}
And incrementing/decrementing when an instance is created/dealloc'd:
- (id) init {
self = [super init];
initCount++;
return self;
}
- (void) dealloc {
[name release];
initCount--;
[super dealloc];
}
But XCode keeps warning me that "'initCount' defined but not used".
Is there any way to solve this, or should I just ignore the warning?