Hi, I'm trying to change some global NSIntegers I have in a class called "globals", but am having some difficulty. My .h and .m for the globals is set out as:
.h
@interface globals : NSObject
+(NSInteger*)levelUnlocked;
+(void)setLevelUnlocked:(NSInteger*)newLevelUnlocked;
@end
---------
.m
#import "globals.h"
static NSInteger* globalsLevelUnlocked = nil;
@implementation globals
+ (NSInteger*)levelUnlocked {
return globalsLevelUnlocked;
}
+ (void)setLevelUnlocked:(NSInteger*)newLevelUnlocked {
if(globalsLevelUnlocked != newLevelUnlocked) {
[globalsLevelUnlocked release];
globalsLevelUnlocked = [newLevelUnlocked retain];
}
}
+ (void)initialize {
if(!globalsLevelUnlocked) {
globalsLevelUnlocked = 1;
}
}
@end
-----------
I can access the integer value of globalsLevelUnlocked by using [globals levelUnlocked], but when I try to set the value from within a layer (globals.h is imported) by using this [globals setLevelUnlocked:12] I get a yellow error saying:
warning: passing argument 1 of 'setLevelUnlocked:' makes pointer from integer without a cast
And as expected, but not appreciated, the program freezes when I call it.
Can anyone please help with this? Thank you!
Jonathan