小编aur*_*789的帖子

Objective-C 现有实例变量必须是 __unsafe_unretained 错误

相同的代码已经在这里受到质疑,但我处理了一个我无法解决的不同问题,可能是因为我是 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
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

所以,在 webberAppDelegate.m 中,我想这是我对这个分数的问题:

  @synthesize window;
  @synthesize webber;
Run Code Online (Sandbox Code Playgroud)

谁给了我这么长的错误:

Existing instance variable 'window' for property 'window' with  assign attribute …
Run Code Online (Sandbox Code Playgroud)

cocoa objective-c

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

cocoa ×1

objective-c ×1