归档 NSMutableArray
我需要归档一个由 ArrayController 控制的 NSMutableArray。我尝试了这个:
[NSKeyedArchiver archivedDataWithRootObject:array];
但是我收到了这个错误:
*** -[NSKeyedArchiver dealloc]:警告:NSKeyedArchiver 已释放 没有 -finishEncoding 呼吁它。
请问我该如何解决这个问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在归档的图表的根对象及其引用/包含的任何内容都必须符合 << NSCoding > ;协议。请参阅编码和解码对象,获取使您的类兼容的代码示例(不要忘记在对象的接口声明中“采用”协议:
@interface MyClass : NSObject < NSCoding > )。
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 >
).