I am having a class in which i am using singleton pattern.I have static method.Now i want call a non static method inside the static method.But i am not able to call it.Please tell me what is the solution.
#import "ThemeManager.h"
@implementation ThemeManager
+(ThemeManager *)sharedInstance
{
NSLog(@"shared instance called");
static ThemeManager *sharedInstance = nil;
if (sharedInstance == nil)
{
sharedInstance = [[ThemeManager alloc] init];
}
[self getPref];//i get error at this line
return sharedInstance;
}
-(void)getPref
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *themeName = [defaults objectForKey:@"theme"] ?: @"default";
NSLog(@"theme name is %@",themeName);
NSString *path = [[NSBundle mainBundle] pathForResource:themeName ofType:@"plist"];
self.theme = [NSDictionary dictionaryWithContentsOfFile:path];
}
@end