-3

Fellows!

I have an app using Core Data where I created one Entity (let's call "Entity1") and one attribute. I implemented it and the app was running perfectly. It was reading, writing and deleting datas.

So, I created a second entity ("Entity2") and I didn´t implement any code related to "Entity2". However, neither "Entity1" nor "Entity2" was running anymore.

After that, I deleted "Entity2" and the app started working perfectly again.

Could you tell me if there is any secret to create multiple entities in Core Data.

IamInTrouble
  • 67
  • 1
  • 7
  • 'neither "Entity1" nor "Entity2" was running anymore' - What on earth does *that* mean? – matt Mar 25 '13 at 15:04
  • My suggestion here is that you read up on Core Data because I believe you are missing some of the fundamental ideas as to what it is and how it is used. I'd first take a look at the Apple Documentation http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/CoreData/cdProgrammingGuide.html and from there branch out to some basic tutorials that can walk you through how to use it on basic projects. Entities aren't something that are "run" and as such the question doesn't really make a whole lot of sense. – Matt C. Mar 25 '13 at 15:09
  • Ok. Bear with me. I am new over here. When I say that the entities are not working, I want to say the app stops running when it try to access the part of the code related with the entities. Thanks. – IamInTrouble Mar 25 '13 at 15:59
  • The "app stops running"? With what symptoms? Error messages? Crash logs? Backtraces? Apps can stop running for all kinds of reasons. – Tom Harrington Mar 25 '13 at 16:14

1 Answers1

1

It is because your model file (xcdatamodel) and your existing database are not match. Try to delete your app in simulator or dev device, then build and run again, it should be OK.

And, this is just for development. When you released your app and then want to change the database model, there is impossible to ask your users to "delete your app and reinstall again". When this time, you need a Core Data Model Versioning and Data Migration. But that is another story.

I think you should begin from the basic of Core Data. Refer to this tutorial to get familiar with it. :)

onevcat
  • 4,591
  • 1
  • 25
  • 31
  • Although my question was closed, I really want to thank for your tip, comprehension and pro-activity. I just needed to delete the app from the simulator and run it again. Now it is running perfectly. – IamInTrouble Mar 26 '13 at 03:31