Fernando Valente
Fernando Valente

Reputation: 1096

Archive a NSMutableArray

I need to archive a NSMutableArray which is being controlled by an ArrayController. I tried this:

[NSKeyedArchiver archivedDataWithRootObject:array];

But I got this error:

*** -[NSKeyedArchiver dealloc]: warning: NSKeyedArchiver deallocated without having had -finishEncoding called on it.

How may I solve that please?

Upvotes: 0

Views: 2376

Answers (1)

Joshua Nozzi
Joshua Nozzi

Reputation: 61248

The root object of the graph you're archiving and anything referenced/contained by it must conform to < NSCoding > protocol. See Encoding and Decoding Objects for code examples for making your classes compliant (don't forget to "adopt" the protocol in your objects' interface declaration: @interface MyClass : NSObject < NSCoding >).

Upvotes: 1

Related Questions