Adding new attributes in existing coredata model
I am a newbie to coredata never worked with it, right now, I am working on a project on which some work has already been done by the previous developer. Coredata is开发者_Python百科 being used in saving data in the project, Now I need to add some new attributes in the existing coredata models but when I added the attribute (I added @property in the .h file and @dynamic in the .m), the setAttribute is working fine (though idk if it's getting written or not) but when I try to read the attribute the application gets crashed. I don't know much about the coredata, I tried a few blogs they're suggesting to use .xcdatamodel but in my case when I try to open this file the Xcode gets crashed. Now I am very much stuck in here. Kindly help me in this regard, right now I just need a pin point solution to just get through this situation. Thanks in advance for your consideration.
Yep, you need to blow away your old database file first. Do this whenever you make any model changes. On the simulator, select iOS Simulator -> Reset Content and Settings.
If it's on your device, delete the app completely.
Then, try again. This time the backing persistent store will be recreated according to your new model. You'll be good to go.
You should try to use Xcode 4 instead of Xcode 3.2.5
精彩评论