簡體   English   中英

AppDelegate沒有可見的接口聲明選擇器

[英]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;
}

在AppDelegate.m中的someOtherMethod中:

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

為什么? 界面中的其他方法是可見的,但是為什么不這樣呢? 它與成為Class方法有關嗎?

您正在從對象實例(自身)調用類方法。

將方法聲明和實現中的+更改為-,然后對您進行排序。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM