Dane Man
Dane Man

Reputation: 21

encodeWithCoder Not getting called

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

[NSKeyedArchiver archiveRootObject:testSession toFile:filename];

It has:

@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?

Upvotes: 1

Views: 851

Answers (1)

Dane Man
Dane Man

Reputation: 21

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

Upvotes: 1

Related Questions