tim_yng
tim_yng

Reputation: 2671

swift core data crash after adding attributes to an entity

I have an entity in my data model, after I added an additional entity the app crashes when i try to acces it.

var request = NSFetchRequest(entityName: "Entity");
var results=context.executeFetchRequest(request, error: nil); 

Even if there is no items stored in it, it still crashes. If i delete the app and try again it does not crash.

Crash message : "reason = "The model used to open the store is incompatible with the one used to create the store""

Upvotes: 0

Views: 1054

Answers (2)

Icaro
Icaro

Reputation: 14845

Every time you change the database model you must reset the iOS simulator as it has an old version of the database.

enter image description here

Upvotes: 2

Hasnah Ngah
Hasnah Ngah

Reputation: 23

Sometimes deleting all files in Library/Developer/Xcode do the job ..

Upvotes: -1

Related Questions