Hi,

In order to verify an email address you have entered is valid or not using Objective C, use the following code.

- (BOOL) checkYourMail: (NSString *) myEmail{
      NSString *checkMail= @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}";
      NSPredicate *matchMail = [NSPredicate predicateWithFormat:@"Matching %@", checkMail];
      return [matchMail evaluateWithObject:myEmail];
}

🙂

 

4 Comments

  1. dinesh June 16, 2011 at 2:52 pm

    Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘Unable to parse the format string “Matching%@”

    iam getting this error when i run ur code

     
    • dinesh June 17, 2011 at 11:51 am

      can any 1 confirm this code is running fine or with error??

       
  2. dinesh June 24, 2011 at 11:14 am

    it still gives an error

     
  3. Bharath July 12, 2011 at 4:46 pm

    NSPredicate * matchMail = [NSPredicate predicateWithFormat:@”SELF MATCHES %@”, checkMail];

    I think it will work….

     

Leave a Reply

Your email address will not be published. Required fields are marked *

 

 

 

Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.