Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding CoreData to existing Project

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?

like image 243
yershuachu Avatar asked Mar 09 '11 19:03

yershuachu


People also ask

How do I enable Core Data in existing project in Swift?

Get our help adding Core Data to your project So, with your existing project open, create a new project in Xcode (⇧⌘N) and select a Single View App, you can call it whatever you like as we'll be deleting it when we're done. You'll see the “Use Core Data” checkbox on the project options screen, make sure it is checked.

When should I use Core Data?

Use Core Data to save your application's permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.

Is Core Data a database?

Core Data is not a database. Core Data is a framework for managing an object graph. An object graph is nothing more than a collection of interconnected objects. The framework excels at managing complex object graphs.


1 Answers

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.

like image 99
yershuachu Avatar answered Nov 02 '22 08:11

yershuachu