i am creating various nsmanagedobjects from nsdictionaries and while i am iterating over the object’s properties i assign the corresponding values from the dictionary.
currently i check the type like this:
if ([attributeValue isKindOfClass:[NSString class]]) {
...
}
now the problem is that once the managed object is created, all (e.g. string) values do not respond to comparing classes. apparently they are not nsnull either. i miss everything but the nsnumbers.
[[attributeValue class] description]
this is empty for everything but the nsnumbers on the unset values.
is there a way to access the type of the property itself like it is defined in the class header, instead of using the (still unset) value?
Every NSManagedObject in a model has a corresponding NSEntityDescription. You can use the entity description to get the list of attributes and relationships. These will be NSAttributeDescriptions or NSRelationshipDescriptions which have in them the information you require.