CoreData: error: (19) PRIMARY KEY must be unique

Set the Z_MAX to largest Z_PK value in the corresponding table.

UPDATE "main"."Z_PRIMARYKEY" SET "Z_MAX" = n where "Z_ENT" = n

Cited from: why is this code raising the coredata error 19 primary key must be unique

Advertisements

Multithreading with Core Data

…….
…….
…….
@synchronized(self)
{

  1.     Create new NSManagedObjectContext object
  2.     Set persistent store coordinator of main thread’s NSManagedObjectContext to new NSManagedObjectContext object
  3.     Fetch NSManagedObject from DB using new NSManagedObjectContext object
  4.     Do modifications on NSManagedObject object
  5.     save new NSManagedObjectContext object
  6.     Merge new NSManagedObjectContext object changes with Main thread’s NSManagedObjectContext object

}
…….
…….
…….

Make use of onFinishParsing method from the following link
http://stackoverflow.com/questions/2009399/cryptic-error-from-core-data-nsinvalidargumentexception-reason-referencedata64

Blogged with the Flock Browser

Tags: , , , , , ,