看来你们都把我的问题弄错了。我终于像这样解决了。我必须在 emailIdTextField 中验证两者(电子邮件 ID && 电话号码)
NSString *emailRegEx = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];
NSString *phoneRegex = @"^((\\+)|(00))[0-9]{6,14}$";
NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex];
if([emailTest evaluateWithObject:self.emailTextField.text] == NO && [phoneTest evaluateWithObject:self.emailTextField.text] == NO)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Can't login" message:@"Please enter a valid email id / phone no. (abc@xyz.com OR +11234567890)" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
else
{
//login successful
}