Reputation: 765
Can't seem to nail this issue here. Any idea what needs to be changed? I'm using Xcode 4.2.
Error: AppDelegate.m:23:6: error: receiver type 'AppDelegate' for instance message does not declare a method with selector 'setupHUD' [4]
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
LoginViewController *loginVC = [[LoginViewController alloc] init];
UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:loginVC];
navCon.navigationBarHidden = YES;
self.window.rootViewController = navCon;
[self setupHUD];
[self.window makeKeyAndVisible];
return YES;
}
- (void) setupHUD
{
//setup progress hud
self.HUD = [[MBProgressHUD alloc] initWithFrame:self.window.bounds];
[self.window addSubview:self.HUD];
self.HUD.dimBackground = YES;
self.HUD.minSize = CGSizeMake(150.f, 150.f);
self.HUD.delegate = self;
self.HUD.isCancelButtonAdded = YES;
self.HUD.labelText = @"Loading";
}
Upvotes: 1
Views: 337
Reputation: 18363
Prior to Xcode 4.3, you need to forward declare methods called within the same @implementation
block, so make sure to add the declaration of setupHUD
to either the class extension (the list of declarations inside AppDelegate.m that starts with @interface AppDelegate ()
), or the @interface
block in AppDelegate.h.
For example, in AppDelegate.m:
@interface AppDelegate ()
// Other declarations...
- (void)setupHUD;
@end
Or in AppDelegate.h:
@interface AppDelegate : NSObject <UIApplicationDelegate>
// Other declarations
- (void)setupHUD;
@end
Upvotes: 1