Guys,
My method + (void) initialized is not called and I'm very new in Objective C. The code is in the book iPhone Game Development and I have to call the method explicitly to work. The code in the .m file is that:
ResourceManager *g_ResManager;
@implementation ResourceManager
//initialize is called automatically before the class gets any other message, per from http://stackoverflow.com/questions/145154/what-does-your-objective-c-singleton-look-like
+ (void) initialize
{
static BOOL initialized = NO;
if(!initialized)
{
initialized = YES;
g_ResManager = [[ResourceManager alloc] init];
}
}
...
@end
But in the .h file a external declaration of the variable is made:
extern ResourceManager *g_ResManager; //paul <3's camel caps, hungarian notation, and underscores.
@interface ResourceManager : NSObject {
...
}
...
@end
I tried everything (remove the external, put static in the .m declaration) and always get compilation errors. The code above compiles but the method initialize is never called (putted a breakpoint to see that).
Some clue?