Re: NSArrayController: Objects with empty strings
Re: NSArrayController: Objects with empty strings
- Subject: Re: NSArrayController: Objects with empty strings
- From: Keary Suska <email@hidden>
- Date: Tue, 28 Apr 2009 14:07:25 -0600
On Apr 28, 2009, at 1:39 PM, Alexander Spohr wrote:
Am 28.04.2009 um 21:22 schrieb Keary Suska:
NSMutableDictionary *theDicRow = [NSMutableDictionary
dictionaryWithObjectsAndKeys:
@"Text A", @"colA",
@"", @"colB",
nil ];
I am not surprised to see this behavior, for various reasons. The
short answer is no, you can't have an empty string for a key in
conjunction with an NSArrayController. What would be the key path
for an empty string?
As a note: the code sets the value to the empty string. The key is
colB.
It pays to pay attention. Sorry for that.
Anyway, I am still not entirely surprised, as the GUI doesn't
distinguish between empty and nil values. At least as far as an
NSTextField/Cell is concerned. I would be curious whether there is a
binding to the value, and if unbound, the behavior remains.
I have had to deal with this situation particularly as it related to
RDBMS's, which *do* distinguish between NULL and and empty, and it's
an important distinction. In cases where you know you will need to
handle an empty value and you want to make sure it will *never* be
nil, you can use a transformer.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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