On Wed, Jun 10, 2009 at 1:55 PM, Alexander Spohr <a...@freeport.de> wrote:

> Your NSUserDefaults do not contain a default for the color. Hence the
> complaining of the color well. Provode a default color and it will work.
>
>        atze
>
> ps. what are all those ****** doing in your mail?
>
>
> Am 10.06.2009 um 18:13 schrieb Lorenzo Thurman:
>
>  I've just added an NSColorWell to my application. I bound it to my
>> NSUserDefaultsController with a controller key of values, model key path
>> values and a value transformer of NSUnarchiveFromData. When I run my
>> program
>> and click on the color well, I get this error in the console:
>>
>> **** Assertion failure in -[NSColorPanelColorWell setColor:],
>> /SourceCache/AppKit/AppKit-949.46/AppKit.subproj/NSColorWell.m:496*
>>
>> *Invalid parameter not satisfying: aColor != nil*
>>
>> *I checked COcoaBuilder and google, but could not find and answer to this,
>> but I did find this tutorial at Stanford U:*
>>
>> *CocoaBindingsTutorial.pdf<
>> http://www.stanford.edu/class/cs193e/Downloads/CocoaBindingsTutorial.pdf>
>> *
>>
>> *This suggests what I've done is correct, but clearly, I've either missed
>> something or there is a bug somewhere. Can someone provide me with some
>> insight? I've running XCode 3.1 on Leopard.*
>>
>> *Thanks*
>>
>> *
>> *
>>
>> --
>> "My break-dancing days are over, but there's always the funky chicken"
>> --The Full Monty
>> _______________________________________________
>>
>> 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/atze%40freeport.de
>>
>> This email sent to a...@freeport.de
>>
>
> I use +initialize to provide a default value for the color well.

NSColor * color = [NSColor selectedMenuItemColor];

[defaults setObject:[NSArchiver archivedDataWithRootObject:color] forKey:
@"textColor"];

NSData * colorData = [defaults objectForKey:@"textColor"];


// Other default values


[[NSUserDefaultsController sharedUserDefaultsController] setInitialValues
:defaults];


There is a Data value in the preferences file, so there must be something
else going on.


-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
_______________________________________________

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

Reply via email to