core data - NSManagedObjectContextObjectsDidChangeNotification deleted objects issue -


it appears though i've exposed strange issue deleted objects not deleted. occurs when i'm responding thensmanagedobjectcontextobjectsdidchangenotification.

more specifically: have list of <->>b. cascade deletes 'owned' instances of b.
when delete instance of a, it's 'owned' b instances deleted, instance not deleted.

when invoke [context processpendingchanges]; @ top of notification handler, issue seems only occur when delete last object. otherwise, instances of tend stick around.

so, seems root of issue in don't understand core data. figuring out why has been unproductive. can list reason(s) might see behavior?

i found 2 reasons can happen:

a) in case first strategy build temporary graphs of deleted managed objects organizational convenience. must modify deleted objects in temporary managed object context, or else changes make deleted objects supersede deletion. reset temporary context you're done operating on (stale) deleted managed objects.
b) objects must have reference count of 0 when deleted. means have released fetched results controllers, nsarrays, etc. prior deletion.

satisfying , b solved issue.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -