• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What exactly happens when I use Core Data's 'Remove' button?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 15:34:31 +0200

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: What exactly happens when I use Core Data's 'Remove' button?
      • From: "I. Savant" <email@hidden>
References: 
 >Re: What exactly happens when I use Core Data's 'Remove' button? (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: NSMatrix equivalent in MFC/Windows?
  • Next by Date: Re: What exactly happens when I use Core Data's 'Remove' button?
  • Previous by thread: Re: What exactly happens when I use Core Data's 'Remove' button?
  • Next by thread: Re: What exactly happens when I use Core Data's 'Remove' button?
  • Index(es):
    • Date
    • Thread