• 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: Dave Reed <email@hidden>
  • Date: Fri, 16 Nov 2012 12:44:58 -0500

On Nov 16, 2012, at 12:37 PM, Kyle Sluder wrote:

> On Nov 16, 2012, at 9:29 AM, email@hidden wrote:
>
>>
>> On Nov 15, 2012, at 8:22 PM, Rick Mann wrote:
>>
>>>
>>> On Nov 15, 2012, at 17:04 , Kyle Sluder <email@hidden> wrote:
>>>
>>>> Override -didChangeValueForKey:?
>>>
>>> Apparently we are strongly discouraged from overriding those methods. :-)
>>>
>>> --
>>> Rick
>>
>> Is this documented? What would be wrong with overriding it, calling [super didChangeValueForKey:] and then doing whatever else you need to do?
>
> From the NSManagedObject docs:
>
>> As with any class, you are strongly discouraged from overriding the key-value observing methods such as willChangeValueForKey: and didChangeValueForKey:withSetMutation:usingObjects:.
>
> Two theories as to why:
>
> - People might forget to call super.
> - KVO checks to see if -didChangeValueForKey: is overridden, and if not it calls the IMP directly, bypassing ObjC message dispatch.
>
> --Kyle Sluder

Ok, thanks for the info. Forgetting to call super doesn't seem like it would cause Apple to "strongly discourage" as there are lots of methods in various Cocoa frameworks where you do need to call super, but I wondered if there were some hidden performance optimizations or if it somehow might break something. I'm just trying to learn - not argue with you.

Thanks,
Dave

_______________________________________________

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: Jerry Krinock <email@hidden>
References: 
 >Getting notified of any change to a specific NSManagedObject? (From: Rick Mann <email@hidden>)
 >Re: Getting notified of any change to a specific NSManagedObject? (From: Kyle Sluder <email@hidden>)
 >Re: Getting notified of any change to a specific NSManagedObject? (From: Rick Mann <email@hidden>)
 >Re: Getting notified of any change to a specific NSManagedObject? (From: email@hidden)
 >Re: Getting notified of any change to a specific NSManagedObject? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Getting notified of any change to a specific NSManagedObject?
  • Next by Date: NSMapTable thread safety (with with ARC and weak objects)
  • 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