我有一个对象我想变成一个实例变量。这工作:为什么我无法将此对象转换为实例变量?
ZipFile *newZipFile = [[ZipFile alloc] initWithFileName:zipPath mode:ZipFileModeCreate];
但是当我尝试将其更改为这它不起作用:
.H:
@interface PanelController : NSWindowController <NSWindowDelegate> {
ZipFile *_zipFile;
}
@property (nonatomic, assign) ZipFile *zipFile;
.M:
@synthesize zipFile = _zipFile;
...
// get a syntax error here
zipFile = [[ZipFile alloc] initWithFileName:zipPath mode:ZipFileModeCreate];
编辑:我能够解决这个问题,把它放在我的界面中,并删除@property:
ZipFile *newZipFile;
我想我不能分配getter和setter方法只是任何对象?但为什么不会它工作,如果我做的:
ZipFile *zipFile;