开发者

encodeWithCoder Not getting called

开发者 https://www.devze.com 2023-01-17 02:02 出处:网络
I have an object (testSession) that complies to NSCoder and when I use: [NSKeyedArchiver archiveRootObject:testSession toFile:filename];

I have an object (testSession) that complies to NSCoder and when I use:

[NSKeyedArchiver archiveRootObject:testSession toFile:filename];

It has:

开发者_如何学JAVA
@interface Session : NSObject <NSCoding> {

and has encodeWithCoder: and initWithCoder: functions. Neither are getting called. What would prevent this?

- (void)encodeWithCoder:(NSCoder *)encoder
- (id)initWithCoder:(NSCoder *)decoder

Do these need to be declared in the header?


WHOOPS! I forgot to retain my testSession object after creating it. I'm a tad rusty :P

0

精彩评论

暂无评论...
验证码 换一张
取 消