Problems with CoreDataBooks Example from Apple
I am currently playing with CoreData and have a problem with the CoreDataBooks Example from Apple.
Basically I just wanted to extend the data model. I updated the model class aswell and no compiler error, butr a crash when I want to start the example.
Unresolved error Error Domain=NSCocoaErrorDomain Code=134130 UserInfo=0x1316ce0 "Operation could not be completed. (Cocoa error 134130.)", { URL = file://localhost/.../CoreDataBooks.sqlite; ...some nonsense info ... reason = "Can't find model for source store"; }
Do I need to updat the sqlite database ?开发者_运维知识库
Thanks
Whenever you modify or update the data model, make sure you:
Add
NSManagedObject
class header and implementations for any new or modified entities (select the entity in the data modeler and useNew File... > NSManagedObject
to create new class files).Delete your app from the iPhone simulator or device, before rebuilding and reinstalling. You can worry about migration issues later.
Anyway, I needed to version the datamodel before changing anything that would ensure that the model does migrate automatically.
精彩评论