Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData retain/release/delete



That almost answers my question.

But I am concerned about managedObjects whose retain count falls to zero, but which are *not* explicitly deleted using -deleteObject.

Are these automatically deleted from the persistent store on save, or do they hang around?

I create a lot of objects with many relationships which I do not want to track manually. Once they are released from all relationships and their retain count falls to zero, I want them to be deleted from the persistent store since I have no further use for them.

An example of this might be a 'sequence' object, which is an ordered collection of 'scene' objects. Once a sequence has lost all of its scenes and has been removed from any parent sequences, its retain-count will be zero and I would like it to be removed from the persistent store on the next save, since I may create and dispose of hundreds of these objects in the course of writing a screenplay over many weeks.

I don't want to have to track this manually, so I'm trying to find out how exactly it works.



On Apr 29, 2005, at 3:07 PM, Scott Stevenson wrote:

When the MOC saves, is the persistent store overwritten, and the object effectively deleted from the saved file, or does it hang around and have to be deleted manually using the -deleteObject method?

You only have to delete it once, then save. Does that answer the question?


A Managed Object could also be deleted indirectly if it's at the destination end of a relationship which is set to "cascade", and the owner of the relationship is deleted.
--
John Brownlow
Deep Fried Films, Inc

http://www.johnbrownlow.com
http://www.pinkheadedbug.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >CoreData retain/release/delete (From: John Brownlow <email@hidden>)
 >Re: CoreData retain/release/delete (From: Scott Stevenson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.