No declaration of property 'MyViewController' found in the interface.

Hi..

New in here.. I need some help, to be honest.. I just started out with the "Your First iPhone OS Application."

I get the error "no declaration of property 'MyViewController' found in the interface," in my "Hello_WorldAppDelegate.m" (here the error is in @synthesize)

My: Hello_WorldAppDelegate.h is as following:

#import <UIKit/UIKit.h>

@class MyViewController;
@interface Hello_WorldAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
MyViewController *myViewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;


@property (nonatomic, retain) MyViewController *myViewController;

@end

Which I think is where my 'interface' should be.

And my Hello_WorldAppDelegate.m is as following:

#import "MyViewController.h"
#import "Hello_WorldAppDelegate.h"

@implementation Hello_WorldAppDelegate



@synthesize window;
@synthesize MyViewController; //This is where the error pops up.. no declaration of property 'MyViewController' found in the interface


- (void)applicationDidFinishLaunching:(UIApplication *)application {

MyViewController *aViewController = [[myViewController alloc]
initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]];
[self setMyViewController:aViewController];
[aViewController release];

UIView *controllersView = [myViewController view];
[window addSubview:[myViewController view]];

// Override point for customization after application launch
[window makeKeyAndVisible];
}


- (void)dealloc {
[myViewController release];
[window release];

[super dealloc];
}


@end

Can you guys help me out? Thank you so much!

iPhone, iPhone OS 3.1.3

Posted on Apr 10, 2010 5:06 PM

Reply
2 replies

Apr 10, 2010 6:13 PM in response to mikkeljuhl

Hi Mikk, and welcome to the Dev Forum!
mikkeljuhl wrote:
I get the error "no declaration of property 'MyViewController'

It looks like you just need to change the case of 'M' in a couple places:

@synthesize myViewController; // <-- lower case 'm' for instance variable
(void)applicationDidFinishLaunching:(UIApplication *)application {
MyViewController *aViewController =
[[MyViewController alloc] // <-- upper case 'M' for the class
initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle];
[self setMyViewController:aViewController];
[aViewController release];
// ...
}

The second error should show up as soon as you fix the first.
- Ray

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

No declaration of property 'MyViewController' found in the interface.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.