Re: Synthesized properties for scalars not KVO compliant

2009-05-19 Thread Andy Lee

On May 19, 2009, at 7:52 PM, Kiel Gillard wrote:
I have a few scalar (NSUInteger, CGRect etc) ivars in my model  
objects. I have declared identically named properties for these  
scalars and instructed the compiler to synthesize accessor methods  
for them. My controller objects add themselves to the model objects  
as observers with the keypaths to the scalars.


Sounds right, should work.

However, I'm not getting any key-value observing notifications when  
changes to those observed properties occur (observeKeyPath... isn't  
being called at all).


I feel I may be missing something very simple but I have no idea  
what. Any suggestions?


Use NSLog and/or the debugger to question everything.  You say the  
controllers are adding themselves as observers; are they doing so as  
self, or is there a variable that you think is pointing to a  
controller, but might be nil?  You say changes to the properties are  
occurring and you're not setting the ivars directly; how *are* you  
setting the property?  If it's through code, are you positive the  
object you're modifying is == to the object you observed?  How are you  
confirming that the property is actually getting changed?


--Andy

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Synthesized properties for scalars not KVO compliant

2009-05-19 Thread Jerry Krinock


On 2009 May 19, at 16:52, Kiel Gillard wrote:


I feel I may be missing something very simple but I have no idea what.


Never tried it with structs like CGRect but I just bound some integers  
like this yesterday and they KVO works.  The title of your message  
says "not KVO compliant".  Please clarify: Is the console log telling  
you this, or is this your interpretation?



Any suggestions?


Post some code.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Synthesized properties for scalars not KVO compliant

2009-05-19 Thread Kiel Gillard

I should also mention I am not assigning a value to the scalar directly.

On 20/05/2009, at 9:52 AM, Kiel Gillard wrote:


Hi all,

I have a few scalar (NSUInteger, CGRect etc) ivars in my model  
objects. I have declared identically named properties for these  
scalars and instructed the compiler to synthesize accessor methods  
for them. My controller objects add themselves to the model objects  
as observers with the keypaths to the scalars. However, I'm not  
getting any key-value observing notifications when changes to those  
observed properties occur (observeKeyPath... isn't being called at  
all).


I feel I may be missing something very simple but I have no idea  
what. Any suggestions?


Thanks,

Kiel


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com