Key-Value Coding Limitations
Key-Value Coding Limitations
- Subject: Key-Value Coding Limitations
- From: Jonathon Mah <email@hidden>
- Date: Sat, 6 May 2006 00:51:09 +0930
Hi all,
It seems I've come across a bug in key-value coding with direct
instance variable access. With a class such as:
File: MyClass.mm
// Objective-C++ class
@interface MyClass : NSObject
{
NSObject *obj;
NSRect *rectPtr;
cppObject *cplus;
}
@end
Sending [self valueForKey:@"obj"] works as expected, but [self
valueForKey:@"rectPtr"] and @"cplus" raises an
NSUndefinedKeyException. Running class-dump shows C++ pointer objects
are converted to struct cppObject *cplus. It strikes me as strange,
since it's just another pointer; I can even change NSRect* to id, and
it will work as expected. void* raises the exception. Is this a known
limitation of struct/void pointers?
Is there an easy way to access arbitrary instance variables by name,
or must I manually go through the Objective-C class structures?
The reason I want this is for a plug-in I've created which uses class
posing. It requires access to some instance variables that don't have
accessor methods, and accessing them "normally" in my code makes it
more likely to break under future/past versions.
Thanks,
Jonathon Mah
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden