• 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: Incomprehensible KVC Failure!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Incomprehensible KVC Failure!


  • Subject: Re: Incomprehensible KVC Failure!
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 17 Mar 2009 16:12:01 -0700

On Mar 17, 2009, at 15:10, Seth Willits wrote:

I have a property in one of my classes:

NSString * suggestedDiskImageName;
@property (retain, readwrite) NSString * suggestedDiskImageName;
@synthesize suggestedDiskImageName;

Which is just like a dozen others that I declare, except for some reason that is beyond comprehension after my HOUR LONG investigation, when I do:

1) nonNilInstance.suggestedDiskImageName = someValue;
2) [nonNilInstance setSuggestedDiskImageName:someValue];
3) [nonNilInstance setValue:someValue forKey:@"suggestedDiskImageName"];



All of them fail to trigger will/didChangeValueForKey (which I'm overriding to see changes to all properties in my class). It actually changes the value, but it doesn't send the KVC methods. Every other single property works, but this one does not. I've tried multiple values, I've tried renaming the property, I've tried using a different instance variable, I've tried reordering the instance variables, property declarations, and synthesize declarations just incase it was some stupid thing like that, I've even tried calling the code from different locations in my project.......... it always fails!


It's completely boggling my mind.


The only thing that worked was to create an implementation of setSuggestedDiskImageName: and manually call will/ didChangeValueForKey.

Excuse me for starting with the obvious question, but is there something actually KVO-observing nonNilInstance? Without an observer, the notifications aren't sent, and your setter is just a method.


If there's an observer, is it observing the suggestedDiskImageName property? It's possible the notifications are optimized away for properties with no observers, too.




_______________________________________________

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


References: 
 >Incomprehensible KVC Failure! (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: -stringByEvaluatingJavaScriptFromString: return value iphone
  • Next by Date: [ANN] KSOutlineView Framework/Interface Builder Plugin
  • Previous by thread: Re: Incomprehensible KVC Failure!
  • Next by thread: Model & Table Cell Updating Issues
  • Index(es):
    • Date
    • Thread