The Oddler
The Oddler

Reputation: 6718

No declaration of property ... found in interface - But there is

I have the following error: No declaration of "window" found in interface. Though when I look there is one... There's probably something stupid I missed, but can't find it.

PlanetoidsAppDelegate.h

#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>

@interface WebViewExampleAppDelegate : NSObject  {
    NSWindow *window;
    IBOutlet WebView *webView;
}

@property (assign) IBOutlet NSWindow* window;
@property (nonatomic, retain) IBOutlet WebView* webView;

@end

PlanetoidsAppDelegate.m

#import "PlanetoidsAppDelegate.h"

@implementation PlanetoidsAppDelegate

@synthesize window; //<-- error here
@synthesize webView; //<-- error here (well, the same one for webView that is...)

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
}

- (void)awakeFromNib {
    NSString *resourcesPath = [[NSBundle mainBundle] resourcePath];
    NSString *htmlPath = [resourcesPath stringByAppendingString:@"/Planetoids/Planetoids_Game.html"];
    [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:htmlPath]]]; //<-- error: webView undeclared, what makes sense considdering the other errors :P
}

@end

Can anyone here see the error?

Upvotes: 1

Views: 373

Answers (2)

Gabriel
Gabriel

Reputation: 3045

@interface WebViewExampleAppDelegate : NSObject  in .h

@implementation PlanetoidsAppDelegate in .m

Two completely different classes.You need to be implementing WebViewExampleAppDelegate.m and synthesizing those methods in that class.

Also, for this:

@interface WebViewExampleAppDelegate : NSObject  {
    NSWindow *window;
    IBOutlet WebView *webView;
}

try

 @interface WebViewExampleAppDelegate : NSObject  {
        UIWindow *window;
        IBOutlet WebView *webView;
    }

Upvotes: 1

logancautrell
logancautrell

Reputation: 8772

Your interface is WebViewExampleAppDelegate but your implementation is PlanetoidsAppDelegate. These must match.

Upvotes: 4

Related Questions