简体   繁体   中英

No visible interface for AppDelegate declares the selector

AppDelegate.h:

@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>

+ (MBProgressHUD *)showGlobalProgressHUDWithTitle:(NSString *)title;

AppDelegate.m:

+ (MBProgressHUD *)showGlobalProgressHUDWithTitle:(NSString *)title {
UIWindow *window = [[[UIApplication sharedApplication] windows] lastObject];
[MBProgressHUD hideAllHUDsForView:window animated:YES];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:window animated:YES];
hud.labelText = title;
return hud;
}

In someOtherMethod in AppDelegate.m:

[self showGlobalProgressHUDWithTitle:@"Checking for Updates"];  //No visible interface for AppDelegate declares the selector 'showGlobalProgressHUDWithTitle:'

Why? Other methods in the interface are visible, but why isn't this one? Does it have to do with being a Class method?

You're calling a class method from an object instance (self).

Change + to - in your method declaration and implementation, and you're sorted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM