NSDataDetector, 문자열에서 URL 감지

1318 단어 iosNSDataDetector
NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&error];
NSArray *matches = [detector matchesInString:textString options:0 range:NSMakeRange(0, textString.length)];
for (NSTextCheckingResult *match in matches) {
    if ([match resultType] == NSTextCheckingTypeLink) {
        NSRange matchRange = [match range];
	NSURL *url = [match URL];
    }
}

좋은 웹페이지 즐겨찾기