discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVC


From: Helge Hess
Subject: Re: KVC
Date: Wed, 6 Jun 2007 21:45:36 +0200

On Jun 6, 2007, at 20:53, Chris Farber wrote:
There are two parts to KVC: the informal protocol, and the implementation. I made the mistake of thinking you were talking about the implementation for two reasons. In your example, you used takeValue:forKey:; if you had overridden takeValue:forKey:, then it would not be our implementation at fault, and if you had not I could only assume that you were trying to set an ivar or call a method, neither of which can contain unicode. I also had not been thinking about key paths…

Not sure whether its obvious, but we are overriding - handleQueryForUnboundKey:, so the default -valueForKey: *is* triggered and fails due to the ASCII encoding issue. I think the easiest thing to do is to change the key retrieval encoding to UTF-8. This will work for all ASCII keys as-is and the ObjC runtime won't complain about UTF-8 either (it will just not find anything).

As mentioned initially we do not even expect the object to return anything _in this particular case_, instead we expect it to call - handleQueryForUnboundKey:. We notice the missing key and then continue searching for it by other means (which will then be able to resolve it).

Unfortunately the KVC API has no good -canRetrieveValueKey: API. (well, somewhat using NSClassDescription, but this has its own particular issues ... ;-)

Thanks,
  Helge
--
Helge Hess
http://www.helgehess.eu/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]