I am trying to use validatevalue:forkey: method to validate a coredata property.
I have a textfield that I am getting a string from I then want to check that string against my validation.
I am assuming that it is attempting to validate against the Reg. Exp. I have in my model.
However, no matter what I input it will always pass the validation.
EDIT:
The regular expression is a standard regular expression for validating email.
I can post some “official” code tomorrow, but its basically like the following:
NSString *string = textfield.text;
if(![myEntity validateValue:&string forKey:@"email"])
{
// provide necessary user feed back i.e. let user know email is not in valid format}
}
Not sure
validatevalue:forKey: is what you want. This is what the validation should look like:Note that
isValidEmailAddressdoesn’t actually exist. 🙂