持久存储和应用程序更新
我在商店里有一个使用核心数据的 iPhone 应用程序。现在,每次我更改代码中与核心数据相关的内容(即我的托管对象模型或我的模型类)时,我都必须擦除所有数据,因为我收到持久存储错误。
现在我发现我需要对我的应用程序进行更改,并且我不希望我的用户丢失所有数据。我该怎么办?这是我第一次涉足核心数据,因此非常感谢任何帮助。谢谢。
I have an iPhone app up on the store which uses core data. Now, every time I change something in my code with relation to core data, namely my managedobjectmodel or my model classes, I have to wipe all my data since I get a persistent store error.
Now I'm finding i need to make changes to my app and I don't want my users to lose all their data. What do I do? This is my first foray into Core Data so any help is appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要对数据模型进行版本控制。查看 Xcode >设计>数据模型。然后您需要将数据迁移到新模型。根据变化,这可能会变得复杂。
试试这个文档。
You need to version your data model. Check out Xcode > Design > Data Model. Then you need to migrate the data to the new model. This can get complicated depending on the changes.
Try this documentation.
没关系。我需要研究的是版本控制和迁移,不用麻烦。
Never mind. It's versioning and migration that I need to look into, no bother.