Objective c 如何从NSTextCheckingResult返回原始字符串?

Objective c 如何从NSTextCheckingResult返回原始字符串?,objective-c,Objective C,我知道NSURL是在NSTextCheckingResult上返回的,但是如何返回原始字符串呢。NSURL格式化url,除非这里有一个方法使您返回原始url NSError *error = nil; NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes: (NSTextCheckingTypeLink | NSTextCheckingTypePhoneN

我知道NSURL是在NSTextCheckingResult上返回的,但是如何返回原始字符串呢。NSURL格式化url,除非这里有一个方法使您返回原始url

NSError *error = nil; 
NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:
                                (NSTextCheckingTypeLink | NSTextCheckingTypePhoneNumber)
                                                               error:&error];


  [detector enumerateMatchesInString:html 
        options:0 
        range:NSMakeRange(0, [html length]) 
        usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {

           if (result.resultType == NSTextCheckingTypeLink) {
                 NSLog(@"original string is %@", ???);
           }

        }
    }];
尝试:

或者获取你想知道的关于URL的任何信息

       if (result.resultType == NSTextCheckingTypeLink) 
       {
           NSLog(@"original string is %@", 
               [result.URL isFileURL] ? [result.URL path] : [result.URL absoluteString]);
       }