Re: Finding all deleted objects from Core Data
Re: Finding all deleted objects from Core Data
- Subject: Re: Finding all deleted objects from Core Data
- From: Diederik Hoogenboom <email@hidden>
- Date: Thu, 5 Oct 2006 20:37:05 +0200
Remco,
The name: part calling the method should be
name:NSManagedObjectContextObjectsDidChangeNotification, without the
@"".
Kind regards,
Diederik
On 5-okt-2006, at 17:38, Remco Poelstra wrote:
Hi,
do I need to do something more than calling [[NSNotificationCenter
defaultCenter] addObserver:self
selector:@selector(removeDatasheetFile:)
name:@"NSManagedObjectContextObjectsDidChangeNotification"
object:nil];
} from awakeFromNib?
Because my implementation of removeDatasheetFile doesn't seem to
get called.
Regards,
Remco
Op 5-okt-2006, om 16:20 heeft email@hidden het
volgende geschreven:
Remco,
Well in that case you can try registering for the
NSManagedObjectContextObjectsDidChangeNotification notifaction.
The userinfo
dictionary of the notification object passed contains a key called
NSDeletedObjectsKey which contains the NSManagedObject's being
deleted.
Kind regards,
Diederik
Quoting Remco Poelstra <email@hidden>:
Hi,
Thanks for your reply.
This method doesn't solve my problem unfortunatly. This method
(and willSave) are only called for objects which are allready in
the persistent store or are going to end up there. If I have
loaded an object graph and then create and delete an object and
after that send a save: message, then did/willSave isn't called
on that particular object. But it are exactly these objects I
would like to find.
Thanks again,
Remco Poelstra
Op 5-okt-2006, om 13:01 heeft email@hidden het
volgende geschreven:
Remco,
What you can do is subclass NSManagedObject for that entity (if
you haven't
already done that) and add the -didSave method:
- (void)didSave
{
if ([self isDeleted])
[self _removeFile];
[super didSave];
}
Kind regards,
Diederik Hoogenboom
Quoting Remco Poelstra <email@hidden>:
Hi,
I've a Core Data app where instances of a particular entity
contain a filename. When these instances are removed from the
object graph I also want to remove the file. But in order to
support undo management, I can't directly remove the file,
I've to wait until the managed object context is send a save:
message. Now I've the problem that at that time I can only
request the objects that will be deleted from the persistent
store, not the objects that haven't been saved yet. How do I
get a list of all objects that are deleted? The unod manager
also doesn't seem to be able to give me a list of deleted
objects.
Thanks in advance,
Remco Poelstra
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40obviousmatter.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden