Re: What exactly happens when I use Core Data's 'Remove' button?
Re: What exactly happens when I use Core Data's 'Remove' button?
- Subject: Re: What exactly happens when I use Core Data's 'Remove' button?
- From: "Arthur C." <email@hidden>
- Date: Mon, 14 Aug 2006 16:21:01 +0200
You need to be more descriptive. For example, you say you're getting a
"selector not recognized" ... what selector isn't recognized? Is it
"-handleDeletion:"? We could probably assume as much, but if we assume
wrong, we end up only wasting our time.
The message is:
-[NSNull intValue]: selector not recognized (self = 0xa07b9218)
Exception raised during posting of notification. Ignored. -[NSNull
intValue]: selector not recognized (self = 0xa07b9218).
I was 'assuming' that those numbers wouldn't be any more descriptive...
As to your problem ... at a guess, you're passing:
@"NSManagedObjectContextObjectsDidChangeNotification"
... when you should probably be passing ...
NSManagedObjectContextObjectsDidChangeNotification
Good point, fixed. I really thought that this thing was the name(string)
rather than a constant.
Now the method gets called anytime I change an object (as it should).
However, when using the remove button, still the same error message...
Further suggestions?
Thanks so far,
Arthur C.
I don't know if this is your complete problem, but what you're passing
is definitely not right, so I'm willing to bet it's definitely not
helping. :-)
--
I.S.
On Aug 14, 2006, at 9:34 AM, Arthur C. wrote:
NSManagedObjectContext offers a notification named
NSManagedObjectContextObjectsDidChangeNotification. Observe this and
take appropriate action upon the managed objects found in the user info
dictionary under the key NSDeletedObjectsKey.
I have tried that, but on removes I only receive an error message saying
'selector not recognized'. The code is as follows:
@implementation ObjectToBeRemoved // has n instances
-(void) awakeFromInsert // same for awakeFromFetch
{
// ...
[[NSNotificationCenter defaultCenter] addObserver: self
selector:@selector(handleDeletion:)
name:@"NSManagedObjectContextObjectsDidChangeNotification" object: nil];
}
- (void) handleDeletion: (NSNotification *) notification
//>>{
if ([self isDeleted])
{
// unregister for KVO
}
}
I definitely want the observer to be 'self', as I need to remove it as
KVO observer. Therefore I also need the reference to the object that is
observing 'self', which is only available from inside this object.
Is this correct? I believe the handler should get called also when an
object is changed (in any way), added, or removed. But all I get is the
error message after using the remove button, and the handler does not get
called at all.
I hope you have a solution for this as well.
Best regards,
Arthur C.
_________________________________________________________________
MSN Search, for accurate results! http://search.msn.nl
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
_______________________________________________
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