2011-11-28 50 views
1

我有以下錯誤:沒有聲明的「窗口」在界面中找到。 雖然當我看到有一個...有可能是我錯過了一些愚蠢的,但無法找到它。沒有屬性聲明...在界面中找到 - 但有

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 

能有人在這裏看到的錯誤?

回答

4

您的界面是WebViewExampleAppDelegate,但您的實施是PlanetoidsAppDelegate。這些必須匹配。

+0

人,謝謝!我知道這是愚蠢的xD –

+0

它出色地工作:D雖然由於你的回答太快而不能接受它:o現在接受它但是;) –

+0

np,感謝你的快速答案:D –

1
@interface WebViewExampleAppDelegate : NSObject in .h 

@implementation PlanetoidsAppDelegate in .m 

兩個完全不同的類。您需要實現WebViewExampleAppDelegate.m並在該類中合成這些方法。

此外,對於這一點:

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

嘗試

@interface WebViewExampleAppDelegate : NSObject { 
     UIWindow *window; 
     IBOutlet WebView *webView; 
    } 
相關問題