How to validate email in iOS Objective- C?

How to validate email in iOS Objective- C?
Last updated:1/11/2017 11:17:56 PM

1 Answers

Jayden Bell
Jayden Bell

 You can validate email using the following objective c code-

 

-(BOOL)isValidEmail:(NSString
*)emailString
{
NSString *filterString = @"^[A-Z0-9a-z\\._%+-]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}$";
NSPredicate *emailPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", filterString];
return [emailPredicate evaluateWithObject:emailString];
}
 

Answer