How can I validate phone number using NSDataDetector. In my project, the anything higher than 14 text length is also valid but NSDataDetector does not detect it that way.
I am using the code from the following stackoverflow post: NSTextCheckingResult for phone numbers
you can't use NSDataDetector
its available in for only [10_7,4_0]
So its easy and proper way to validate Phone Number Like bellow way instead of NSDataDetector
NSString *string =@"121453315";
NSString *phoneRegex = @"^((\\+)|(00))[0-9]{6,14}$";
NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex];
BOOL phoneValidates = [phoneTest evaluateWithObject:string];