表视图核心数据中的 NSException

发布于 2024-10-08 20:20:27 字数 498 浏览 0 评论 0原文

我正在开发一个应用程序,显示来自 coredata 数据库的基本信息, 当我点击保存按钮时,我有数据库保存信息, 但是当我想在表的另一个视图中显示数据时, 我没有收到任何错误,但出现 NSexeption>

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:    '+entityForName: could not locate an NSManagedObjectModel for entity name 'Contacts''

我在sqlite图形界面中检查数据保存正确,但没有显示在表中,出现上述错误,

请问如何修复?

我的小项目是在 这里!

非常感谢!

Im developing an app that shows basic info from a coredata db,
I have the db saving info when hit save button,
but when I want to show the data in another view in a table,
I get no errors, but an NSexeption>

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:    '+entityForName: could not locate an NSManagedObjectModel for entity name 'Contacts''

the data is saving correctly as I checked it in a sqlite graphical interface, but not showing in the table, with the above error,

how to fix it please?

my little project is in
here!

thank you so much!

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

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

发布评论

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

评论(1

稚气少女 2024-10-15 20:20:27

好的,您的 managedObjectContext 需要来自 App Deleagte,在 ShowViewController 中尝试:

    managedObjectContext = [(CoreDataEnsaAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];

现在,上下文来自 _context,它是 NULL。

Okay, your managedObjectContext needs to come from the App Deleagte, in ShowViewController try:

    managedObjectContext = [(CoreDataEnsaAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];

Right now, the context is coming form _context, which is NULL.

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