相同的代码已经在这里受到质疑,但我处理了一个我自己无法解决的不同问题,可能是因为我是 Objective-C 的新手,所以我决定提出这个问题:)
webberAppDelegate.h:
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface webberAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
WebView *webber;
}
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet WebView *webber;
@end
webberAppDelegate.m:
#import "webberAppDelegate.h"
@implementation webberAppDelegate
@synthesize window;
@synthesize webber;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSString *urlString = @"http://www.apple.com";
// Insert code here to initialize your application
[[webber mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]];
}
@end
所以,在 webberAppDelegate.m 中,我想这是我对这个分数的问题:
@synthesize window;
@synthesize webber;
谁给了我这么长的错误:
Existing instance variable 'window' for property 'window' with assign attribute must be __unsafe_unretained
对于其他 var "webber" 几乎相同:
Existing instance variable 'webber' for property 'webber' with assign attribute must be __unsafe_unretained
感谢您的帮助,我真的很感谢 Stackoverflow 社区!