我有以下课程:
@interface SpWindow : NSWindow <NSCoding> {
BOOL _editMode;
SpBgView *bgView;
} ...
...然后我将其称为存档。我的编码方法如下:
- (void) encodeWithCoder:(NSCoder *)aCoder {
NSLog(@"encodeWithCoder CALLED FOR SpWindow");
[super encodeWithCoder:aCoder];
NSLog(@"SpWindow's encodeWithCoder got past the super call");
[aCoder encodeObject:bgView forKey:@"bgView"];
[aCoder encodeBool:_editMode forKey:@"_editMode"];
}
...但是该[super encodeWithCoder:aCoder];
位会在控制台日志中产生以下结果:
encodeWithCoder CALLED FOR SpWindow
<SpWindow: 0x20009f660> does not support archiving
*** -[NSKeyedArchiver finalize]: warning: NSKeyedArchiver finalized without having had -finishEncoding called on it.
...根据 NSWindow 文档,该类符合 NSCoding 协议,所以我不知道为什么会看到这个问题。
有任何想法吗 ?
--- 编辑: NSWindow 的类参考显示:
Conforms to NSCoding (NSResponder)
...不只是"Conforms to NSCoding"
-所以我想这是否意味着只有 NSResponder 位符合 NSCoding ?