Archive a NSMutableArray
I need to archive a NSMutableArray which is being controlled by an ArrayController. I tried this:
[NSKeye开发者_如何学运维dArchiver 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?
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 >
).
精彩评论