CoreData: constraint failed?

I got an error exactly same as this post described.

Followed the hint, sqlite3 open database,

  1. .tables
    command will echo a table named Z_PRIMARYKEY
  2. .schema Z_PRIMARYKEY
    there is a column called Z_MAX with type INTEGER
  3. select * from Z_PRIMARYKEY;
    remember this value.
  4. select max(Z_PK) from ZSTORE;
    I got different max value, because I did some operation outside of iOS.
  5. update Z_PRIMARYKEY set Z_MAX=…;

Problem solved. My concern is, will this kind of error happen in production enviroment?

Advertisements

One thought on “CoreData: constraint failed?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s