I want to access the RootViewController of my App in one of its classes in order to present a modal view controller. I do this by getting the ApplicationDelegate and asking it for the RootViewController and store it in a UIViewController
AppDelegate *appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate;
UIViewController* presentingViewController = appDelegate.viewController;
In my opinion this should work without a warning as RootViewController inherits from UIViewController. However I receive this warning:
Incompatible pointer types initializing 'UIViewController *__strong' with an expression of type 'RootViewController *'
Can someone explain to me why I see this warning?
If it helps - this is the AppDelegate where I define the RootViewController:
@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
RootViewController *viewController;
}
@property (strong) RootViewController *viewController;
I defined my RootViewController like this:
@interface RootViewController : UIViewController {
}