Swift 中 ru_RU 的 UITextChecker

UITextChecker for ru_RU in Swift

我正在尝试为 Swift 2.0 中的俄语单词实现自动完成功能,但我遇到了以下问题。

我已经实现了以下代码来测试 UITextChecker() 的工作原理:

    let textChecker = UITextChecker()
    let getAvailableLanguages = UITextChecker.availableLanguages()
    print(getAvailableLanguages)
    let partial = "leo"
    let completions = textChecker.completionsForPartialWordRange(NSRange(0..<partial.utf16.count), inString: partial,language: "en_US")
    let completions2 = textChecker.guessesForWordRange(NSRange(0..<partial.utf16.count), inString: partial, language: "en_US")
    print(completions)
    print(completions2)

此代码打印以下结果,这个结果对我来说不错:

语言列表:

[ru_RU, en_CA, pt_BR, it_IT, ko_KR, nb_NO, de_DE, en_GB, sv_SE, en_AU, en_SG, es_MX, pt_PT, en_IN, fr_FR, es_ES, nl_NL, tr_TR, fi_FI, pl_PL, en_US, da_DK]

completionsForPartialWordRange:

Optional([leonine, leopard, leopardess,leopardesses, leopards, leotard, leotarded, leotards])

guessesForWordRange:

Optional([Leo, lei, lek, lea, led, lee, leg, let, leu, lev, lex, lao, loo, geo, cleo, oleo, lego, leto, leon])

之后我为 ru_RU

实现了相同的代码
    let textChecker = UITextChecker()
    let partial = "кош"
    let completions = textChecker.completionsForPartialWordRange(NSRange(0..<partial.utf16.count), inString: partial,language: "ru_RU")
    let completions2 = textChecker.guessesForWordRange(NSRange(0..<partial.utf16.count), inString: partial, language: "ru_RU")
    print(completions)
    print(completions2)

但是 completionsForPartialWordRange 总是 returns 空数组 ru_RU:

Optional([])

"кош" 的实际结果 应该至少是 "кошка" 但是有一个 空数组 .

尽管这个 guessesForWordRange 对 ru_RU 工作正常:

Optional([каш, ко, кол, коб, код, кое, кож, коз, кои, кой, кок, ком, кон, коп, кор, кос, кот, коф, кою, куш, кэш, нош, шок, ковш, коуш, коша, коше, коши, кошм, кошт, кошу])

我尝试使用不同的俄语单词,但我总是从 completionsForPartialWordRange 方法得到空数组。 我的代码有错误还是一些已知的 Apple 错误?如何使用 completionsForPartialWordRange 方法完成 ru_RU

如果它可以帮助某人,我会通过他们的错误报告服务提供 Apple 答案。

在我写信给 Apple 后,我收到了以下答复:

Engineering has determined that your bug report is a duplicate of another issue and will be closed.

The open or closed status of the original bug report your issue was duplicated to appears in the yellow "Duplicate of XXXXXXXX" section of the bug reporter user interface. This section appears near the top of the right column's bug detail view just under the bug number, title, state, product and rank.

遗憾的是没有更多信息。

更新

已在 IOS10.1

中修复