由于 iPhone 内存不足,核心数据模型更新崩溃

发布于 2024-11-04 14:46:08 字数 137 浏览 9 评论 0原文

我的 iPhone 应用程序更新有我的核心数据存储模型的新版本。我正在使用自定义 NSEntityMigrationPolicy。然而,对于较旧的 iDevice 上的大型核心数据存储(即内存较少),由于内存不足,它会在更新过程中崩溃。处理这个问题有哪些策略?

My iPhone app update has a new version of my core data store model. I am using a custom NSEntityMigrationPolicy. However with large core data stores on older iDevices (i.e. with less memory), it is crashing in the middle of the update due to low memory. What are some strategies to deal with this issue?

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

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

发布评论

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

评论(2

风吹过旳痕迹 2024-11-11 14:46:08

我还没有完成核心数据更新,所以我没有经验可以借鉴,但我怀疑最可能的原因是代码试图立即加载所有内容。我建议看看是否可以批量进行 X 记录的迁移,以便处理开销更小。

I haven't done a core data update so I don't have the experience to drawn from, but I suspect that the most likely cause is that the code is trying to load everything at once. I'd suggest seeing if it's possible to do the migration in batches of X records so the processing overhead is smaller.

梦与时光遇 2024-11-11 14:46:08

请参阅 核心数据模型版本控制和数据迁移编程指南:多次传递 — 处理大型数据集

基本上,您可以按可管理的块进行迁移,而不是一次性完成。在开始迁移之前,请检查可用内存。如果很紧,请警告用户您要使用较慢的方法。

See the Core Data Model Versioning and Data Migration Programming Guide: Multiple Passes—Dealing With Large Datasets

Basically, you do the migration in manageable chunks instead of in all one go. Before you start a migration, check available memory. If it is tight, warn the user you've go to use a slower method.

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