I am using the code provided here for the validation Check that an email address is valid on iOS and in this SO answer I am just calling the method like so
-(BOOL) NSStringIsValidEmail:(NSString *)checkString
{
BOOL stricterFilter = YES;
NSString *stricterFilterString = @"[A-Z0-9a-z\\._%+-]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}";
NSString *laxString = @".+@([A-Za-z0-9]+\\.)+[A-Za-z]{2}[A-Za-z]*";
NSString *emailRegex = stricterFilter ? stricterFilterString : laxString;
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:checkString];
}
Then within my code like so:
NSString *emailCheck = self.txtEmail.text;
//prints boolean statement
NSLog([self NSStringIsValidEmail:emailCheck] ? @"Yes" : @"No");
//validate email
if([self NSStringIsValidEmail:emailCheck]) {
[self alertStatus:@"Please enter a valid email" :@"Register Failed!" :0];
//enables button on login error
[btnRegister setEnabled:YES];
[self callProgressBar:NO];
}
I added the NSLog to see if I can get an output but it now crashes on the NSLog with a light blue lldb error only. Any help would be appreciated.