2

我的代码在操场上工作,Xcode 没有显示任何错误,但是当我在命令行上编译文件时,它会返回错误

use of undeclared type NSLinguisticTagScheme
and String has no member 'tokenType'

这是问题代码。

let tagSchemes : [NSLinguisticTagScheme] = [ .tokenType]
let tagger : NSLinguisticTagger = NSLinguisticTagger(tagSchemes: tagSchemes, options: 0)
let options : NSLinguisticTagger.Options = [ .omitPunctuation, .omitWhitespace]

tagger.string = text
let range = NSRange(location: 0, length: text.utf16.count)

tagger.enumerateTags( in: range, unit: .sentence, scheme: .tokenType, options: options, using: 
{ tag, tokenRange, stop in
    let token = (text as NSString).substring(with: tokenRange)
    sentences.append(token)
})

有任何想法吗?

4

1 回答 1

0

更新 Xcode 解决了这个问题

于 2017-10-20T00:00:03.883 回答