修复核心数据失败 [英] Fix Core Data Fail

查看:143
本文介绍了修复核心数据失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用商店中有一个使用Core Data的应用,我必须在明天发布更新。然而,我遇到一些问题与Core Data.I由于错误修改我的模型在Core Data,现在我的应用程序崩溃。我尝试迁移数据,但应用程序仍然崩溃,当我在我的iPhone上更新它。

I have an app in the app store that uses Core Data and I have to release an update by tomorrow. However, I am experiencing some problems with Core Data.I by mistake made changes to my model in Core Data and now my app is crashing. I tried migrating the data but the app still crashes when I updated it on my iPhone. Is there anyway to fix it?

非常感谢您的帮助!

我正在尝试将.mom文件添加到应用程序,但无法将其添加到软件包中:

I am trying to add the .mom file to the app but I can not get it into the Bundle:

编辑2:完全是Planner.xcdatamodeld:

EDIT 2: Do I delete the entirely Planner.xcdatamodeld:

推荐答案

您可以从生产应用程序包中恢复原始Core Data模型。

You can recover the original Core Data model from the production app's bundle.

使用Finder打开应用程序包(显示包内容)并查找.mom文件或.momd目录。

Use Finder to open the app bundle (Show Package Contents) and look for a .mom file or a .momd directory.

将文件或目录复制到软件包外部的某个位置。

Copy the file or directory to some location outside the bundle.

使用Core Data创建一个新的XCode项目。

Create a new XCode project with Core Data.

在XCode中选择新创建的项目Core Data模型。

In XCode select the newly created projects Core Data model.

转到XCode Editor - > Import菜单并选择您刚刚复制的.mom文件,如果需要在.momd目录中找到正确的版本。

Go to the XCode Editor -> Import menu and select the .mom file you have just copied, if need be find the correct version in the .momd directory.

您现在应该在XCode中保存模型并将模型文件复制到原始项目...

You should now have the model in XCode, save and copy the model file to you original project...

在XCode中从项目中删除不正确的模型(请记住先保存一个副本,新的更改)

In XCode delete the incorrect model from your project (remember to save a copy first so you have a copy of the new changes)

使用XCode添加文件...菜单将旧模型添加到原始项目

Use the XCode Add File to... menu to add the old model to the original project

现在编译并运行应用程序以确认它正确打开旧文件

Now compile and run the app to confirm it opens the old file correctly

现在添加一个新的模型版本并将更改添加到此新版本 - 请确保选择更改之前在XCode中的新模型版本

Now add a new model version and add the changes to this new version - make sure you select the new model version in XCode before making changes

这篇关于修复核心数据失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆