core data - How can I check which class declares a property from a NSAttributeDescription variable? -
myclassa inherits nsmanagedobject.
myclassb inherits myclassa.
myclassa has property, let's call classaprop.
myclassb has property, let's call classbprop.
i have instance of myclassb, myclassb. want loop through managed attributes of instance this:
[myclassb.entity.attributesbyname enumeratekeysandobjectsusingblock:^(nsstring *key, nsattributedescription *attribute, bool *stop) {}]}
so within block, each attribute (classaprop, , classbprop) how can check if myclassa or myclassb declared properties.
within block, if @ [attribute description] see like:
proxy prop named classaprop on ed myclassb, real (<nsattributedescription: 0x7fce49536be0>), name classaprop, isoptional 0, istransient 0, entity myclassa, renamingidentifier classaprop, validation predicates ( ), warnings ( ), versionhashmodifier (null) userinfo { }, attributetype 800 , attributevalueclassname nsnumber, defaultvalue 1
internally seems it's possible access declaring class, can't seem find way access myself.
the way i've solved create instance of nsentitydescription of myclassa check against
[classadescription.attributesbyname.allkeys containsobject:thekey];
that way can filter out properties implemented myclassa aim.
Comments
Post a Comment