Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings/NSUserDefaultsController issue



On 09/03/2007, at 2:51 AM, Keary Suska wrote:

on 3/7/07 9:46 PM, email@hidden purportedly said:

At this point I should
mention that "Device" is a subclass of NSMutableDictionary. The
objects seem to get stored in NSUserDefaults fine - I can see encoded
data when I `defaults read <domain>` from the command line, but my
subclass's initWithCoder: and encodeWithCoder: implementations are
never called. The objects appear to be NSMutableDictionarys when I
`po [device class]` (where "device" is a reference to one of these
objects - the same thing happens if I do something like `po
[[[devicesController arrangedObjects] objectAtIndex:0] class]`). So
it seems like the "Object Class Name" field is being ignored and the
array controller is creating NSMutableDictionarys.

I am not sure if you followed, or were involved in the recent thread
regarding subclassing collection objects. In short, you are aware that you
can't subclass an NSDictionary like any other object? Just checking, since
attempting to do so will cause unexpected behavior, as well as hangs and
crashes.


If you *have* properly subclassed an NSMutableDictionary, I am inclined to
think that the issue lies in your subclass, since it would have to be
somewhat complex.


There may be other issues, but this is a good place to start.


Thanks again Keary. The main problem turned out to be something so stupid that I won't mention it. I missed that thread the first time round but I went back and read it and changed the class to store a dictionary as a member variable and overload KVC methods instead. I found the problem _after_ I did this so I'm not sure if it would have worked the other way, but it sounds like it would have been a bad idea anyway.


Cheers,
Loukas
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden
References: 
 >Re: Bindings/NSUserDefaultsController issue (From: Keary Suska <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.