I was expecting to find that in the NSAttributeDescription class, but only the default value is there.
Behind the scene I tought a validationPredicate was created but trying to reach it using
NSDictionary* dico= [[myManagedObject entity] propertiesByName];
NSAttributeDescription* attributeDescription=[dico objectForKey:attributeKey];
for (NSString* string in [attributeDescription validationWarnings])
just get me nowhere, no validationWarnings, no validationPredicates...
any thoughts on this ?
Edit1: It seems that getting the entity straight from the managedObject doesn't give you the full picture. Getting the Entity from the NSManagedObjectModel permits to reach the validationWarnings & validationPredicates...
Edit2:
Using the following code just after the creation of the model will list all the validationPredicates of the model. For some reasons, using it later (at the time I try too validate for example) will not display anything !
for (NSEntityDescription *entity in managedObjectModel) {
for (NSAttributeDescription* attributeDescription in [entity propertiesByName])
for (NSPredicate* predicate in [attributeDescription validationPredicates])
{
NSLog(@"---%@",[predicate predicateFormat]);
}
}