I have a bunch of simple NSManagedObject
s I create in a unit test. They just have a single name
attribute of type NSString *
. I always
I haven't tried obtaining class information from an ivar, but I know that @property
declarations do encode information about the class. For instance, this property declaration:
@property (copy) NSString *normalString;
results in this attribute string (retrieved using property_getAttributes()) at runtime:
T@"NSString",C,VnormalString
I've written some open source parsing code for this information.
Once you have the class name, you can convert it into an actual Class object using NSClassFromString(), and message the result from there.
Disclaimer: This probably shouldn't be depended upon for production applications, as it is undocumented.