开发者

Archive a NSMutableArray

开发者 https://www.devze.com 2022-12-21 22:37 出处:网络
I need to archive a NSMutableArray which is being controlled by an ArrayController. I tried this: [NSKeye开发者_如何学运维dArchiver archivedDataWithRootObject:array];

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

0

精彩评论

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

关注公众号