I am trying to call a method from a NSObject class from my AppDelegate. Usually this works if calling from a UIViewController but not having luck within the AppDelegate. My code:
AppDelegate.m
#import "ACManager.h"
@implementation AppDelegate {
ACManager *acManager;
}
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[acManager login];
}
ACManager.h
@interface ACManager : NSObject
-(void)login;
@end
ACManager.m
+(ACManager*)sharedInstance {
static ACManager *sharedInstance;
@synchronized(self) {
if (!sharedInstance) {
sharedInstance = [[self alloc]init];
}
}
return sharedInstance;
}
-(void)login
{
NSLog(@"login run");
}
@end
Any ideas thank you. Is there a different way around this when calling from the app delegate?