消息发送到已释放的实例 - NSUserDefaults

发布于 2024-12-24 16:33:42 字数 534 浏览 1 评论 0原文

我有一个奇怪的问题。这种情况突然开始发生在以前没有问题的代码中。

我有一个像这样的简单代码:

[[NSUserDefaults standardUserDefaults] setObject:viewControllersList forKey:kViewControllersKey];
[[NSUserDefaults standardUserDefaults] synchronize];    

我将一些信息保存到 UserDefaults 中(用于状态保存)。

今天突然在这段代码的第一行我开始收到

*** -[CFDictionary isNSDictionary__]: message sent to deallocated instance 0x65bc5d0

它几乎总是发生,但不完全是这样。如果我从模拟器中删除应用程序,清理项目并重建/运行,那么它就可以工作。如果我停止应用程序并重新启动 - 错误又回来了。

我完全被困在这个问题上。有什么想法吗?

I've got a strange issue. This is suddenly started happening in the code that used to work with no problem.

I have a simple code like this:

[[NSUserDefaults standardUserDefaults] setObject:viewControllersList forKey:kViewControllersKey];
[[NSUserDefaults standardUserDefaults] synchronize];    

Where I'm saving some info into the UserDefaults (for state preservation).

All of a sudden today on the first line of this code I started receiving

*** -[CFDictionary isNSDictionary__]: message sent to deallocated instance 0x65bc5d0

It happens almost always, but not quite. If I delete the app from the simulator, clean the project and rebuild/run, then it works. If I stop the app and re-start - the error is back.

I'm totally stuck at this. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

长安忆 2024-12-31 16:33:42

您尝试添加 NSDictionary (viewControllersList),但此 NSDictionary 已发布

You ar trying to add a NSDictionary (viewControllersList) but this NSDictionary is already released

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