• 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: Getting notified of any change to a specific NSManagedObject?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting notified of any change to a specific NSManagedObject?


  • Subject: Re: Getting notified of any change to a specific NSManagedObject?
  • From: Sean McBride <email@hidden>
  • Date: Thu, 15 Nov 2012 19:32:53 -0500
  • Organization: Rogue Research Inc.

On Thu, 15 Nov 2012 16:19:53 -0800, Rick Mann said:

>I know I can use KVO on a specific property of my NSManagedObject, but
>is there a way to get notified if any property changes? I'm trying to
>avoid a bunch of -addObserver:… and -removeObserer:… calls.

You could create a dependent key, that depends on all your keys of interest, then you just observe that one key.  Like:

+ (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)inKey
{
	NSSet* set = [super keyPathsForValuesAffectingValueForKey:inKey];
	if ([inKey isEqualToString:@"everything"])
	{
		set = [set setByAddingObjectsFromSet:[NSSet setWithObjects:
											  @"firstName",
											  @"lastName",
											  @"age",
											  nil]];
	}

	return set;
}

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Getting notified of any change to a specific NSManagedObject?
      • From: Rick Mann <email@hidden>
References: 
 >Getting notified of any change to a specific NSManagedObject? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Getting notified of any change to a specific NSManagedObject?
  • Next by Date: Re: Getting notified of any change to a specific NSManagedObject?
  • Previous by thread: Re: Getting notified of any change to a specific NSManagedObject?
  • Next by thread: Re: Getting notified of any change to a specific NSManagedObject?
  • Index(es):
    • Date
    • Thread