NSDataDetector Fails With Specific Keywords in String Being Searched
Originator: | ninjalog | ||
Number: | rdar://FB9794791 | Date Originated: | 2021-12-03 |
Status: | Open | Resolved: | |
Product: | iOS & iPadOS | Product Version: | |
Classification: | Incorrect/Unexpected Behavior | Reproducible: | Yes |
SUMMARY: NSDataDetector fails to detect content when: - NSTextCheckingResult.CheckingType.phoneNumber is specified as one of the init types. - One of the keywords (included below) is present in the string being searched. STEPS TO REPRODUCE (Swift): let testString = "fly http://apple.com (800)692-7753" let checkingTypes = NSTextCheckingResult.CheckingType.link.rawValue | NSTextCheckingResult.CheckingType.phoneNumber.rawValue guard let detector = try? NSDataDetector(types: checkingTypes) else { fatalError() } let matches = detector.numberOfMatches( in: testString, options: .reportCompletion, range: NSMakeRange(0, (testString as NSString).length)) EXPECTED RESULT: matches should be equal to 2 ACTUAL RESULT: matches is equal to 0 KEYWORDS (string.count < 7): air,dhl,flt,fly,tnt,ups,vol,voo,flug,flyg,ucus,usps,volo,zbor,colis,fedex,lento,rokov,suivi,track,utair,vuelo,aegean,etihad,flight,iberia,indigo,ontrac,paczka,pobeda,qantas,vlucht
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!