I'm trying to create a singleton. This group of code is meant to establish a settingsMAnager singleton.
Im trying to allocate it but keep throwing an error
Its throwing the error no visible @ interface with NSObject. Declares the selector 'alloc'
Can someone see what's wrong?
Thanks in advance!
//In my .h file I have
+(settingsManager*)getInstance;
-(void)printSettings;
//In My .m file is----
static settingsManager *theInstance = nil;
//Instance Method
+(settingsManager*)getInstance
{
(theInstance == nil)
{
[[self alloc] init];//Im getting "expression result unused" here
}
return theInstance;
}
-(id)alloc
{
theInstance = [super alloc];<------//getting the big error here
return theInstance;
}
-(id)init
{
if (self = [super init])
{
}
return self;
}
(void)printSettings
{
NSLog(@"Hello");
}