归档 NSMutableArray

发布于 2024-08-23 08:39:30 字数 310 浏览 5 评论 0原文

我需要归档一个由 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哭泣的笑容 2024-08-30 08:39:31

您正在归档的图表的根对象及其引用/包含的任何内容都必须符合 << 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 >).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文