Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No visible @interface for 'Appdelegate' declares the selector 'setupTabBarController'

I have created a method in Appdelegate.m

-(void)setupTabBarController {
         // details goes here
}

Now in ABC.m I want to access the setupTabBarController

I have included app delegate:

#import "AppDelegate.h"

And then:

AppDelegate *maindelegate = [[AppDelegate alloc] init];
[maindelegate setupTabBarController];

But it's showing the error,

No visible @interface for 'Appdelegate' declares the selector 'setupTabBarController'

Where I am wrong?

like image 605
Shyantanu Avatar asked Oct 17 '25 14:10

Shyantanu


1 Answers

As the error message states, you need to declare it in AppDelegate.h and then you should call it as:

AppDelegate *maindelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[maindelegate setupTabBarController];

In AppDelegate.h:

@interface AppDelegate : UIResponder <UIApplicationDelegate>

- (void)setupTabBarController;

@end
like image 188
iDev Avatar answered Oct 20 '25 04:10

iDev