Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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
Question marked as Best reply

Posted on Apr 10, 2010 6:13 PM

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
2 replies
Question marked as Best reply

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

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 ID.