I have a Cocoa application which contains a Today Extension. I use Core Data (SQLite) to store and share data between those two. Both apps share a group container to have access to the same data store. Both applications do not only read but as well write data which leads to problems. At times either of the applications throws an error. I experienced three different error types so far:
Could not merge changes
Error in CoreDragRemoveTrackingHandler: -1856
Error in CoreDragRemoveReceiveHandler: -1856
CoreData: error: NULL _cd_rawData but the object is not being turned into a fault
Error in CoreDragRemoveReceiveHandler: -1856 CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. -[__NSCFSet addObject:]: attempt to insert nil with userInfo (null)
From the article Sharing Data with Your Containing App in the iOS dev library (this is not iOS/Cocoa-Touch, but OSX/Cocoa - but the same should apply) I have learned:
To avoid data corruption, you must synchronize data accesses. Use Core Data, SQLite, or Posix locks to help coordinate data access in a shared container.
Can someone please point me into a direction what this exactly means?
mangedObjectContext.save(&error)which then results into an exception and/or returningfalseanderrorcontaining "Could not merge changes". Theerrordoes not contain anything beside that. But my question aims more for a general description, not specific to my code. Something that explains what Apple means by the above quote. - udondan