将CoreData添加到现有项目 [英] Adding CoreData to existing Project

查看:116
本文介绍了将CoreData添加到现有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图添加CoreData到现有项目和
有奇怪的错误...



我得到错误:


由于未捕获的异常而终止应用程序
'NSInvalidArgumentException',原因:
'无法创建
NSPersistentStoreCoordinator $ b nil模型'


在RootView中有一个警告:

   - (NSFetchedResultsController *)fetchedResultsController; 

  _fetchedResultsController.delegate = self; 

并说:


警告:class'RootViewController'
不实施
'NSFetchedResultsControllerDelegate'
协议



$ b

任何想法?

甚至问我,我只是错过了,我改变了.xcdatamodel的名称



我只需要更改managedObjectModel和persistentStoreCoordinator中的名称



希望它能帮助别人。


I am trying to add CoreData to an existing project and there is strange error...

I get the error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'

in RootView there is a warning in:

- (NSFetchedResultsController *)fetchedResultsController;

in line:

_fetchedResultsController.delegate = self;

and it says:

warning: class 'RootViewController' does not implement the 'NSFetchedResultsControllerDelegate' protocol

any ideas?

解决方案

argh!

sorry for even asking, I just missed that I changed the name of .xcdatamodel

I needed just to change the name in managedObjectModel and persistentStoreCoordinator

hope it'll help someone anyway.

这篇关于将CoreData添加到现有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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