Wednesday, 8 January 2014

Email Verification in IOS


 NSString *emailRegEx = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
        NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];

if ([emailTest evaluateWithObject:emailField.text] == NO)
        {
            UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Invalid Email Id!" message:@"Please try again" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil,nil];
            [alert show];
        }else{
            
            UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Almost Finished." message:@"To complete the subscription process, please click the link we sent to you to your email." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil,nil];
            [alert show];
        }

No comments:

Post a Comment