views:

301

answers:

1

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?

+1  A: 

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 >).

Joshua Nozzi
Still no luck :(
Fernando Valente
That doesn't help us help you. :-) Post your code and describe how it's not working.
Joshua Nozzi
Sorry, I forgot. I got these error:2010-02-28 22:22:18.145 My app[53732:a0f] -[content encodeWithCoder:]: unrecognized selector sent to instance 0x1001897402010-02-28 22:22:18.146 My app[53732:a0f] -[content encodeWithCoder:]: unrecognized selector sent to instance 0x100189740
Fernando Valente
Might be a stupid question, but have you actually implemented the `encodeWithCoder:` method for the objects that are in the array?
Abizern
Yeah, I did that
Fernando Valente
All this back-and-forth questioning would be completely unnecessary if you'd post the relevant code.
Joshua Nozzi
I just noticed that it does not happen with any other array. The problem is the one being controlled by the array controller.
Fernando Valente