【问题标题】:Text to Speech API (AVSpeechSynthesisVoice) broken in iOS 13 GM文本到语音 API (AVSpeechSynthesisVoice) 在 iOS 13 GM 中损坏
【发布时间】:2020-02-20 05:53:25
【问题描述】:

更新

我在另一台设备上安装了 iOS 13 GM,没有遇到这个问题。因此,我不再确定这是否特定于 iOS 13 GM,或者与我安装它的方式有关。在第一台设备(iPhone X)上,我进行了升级(通过 iTunes 中的“选项键 + 检查更新按钮”)。在第二台设备(iPhone SE)上,我进行了完全恢复。尚不确定是什么原因导致它进入这种状态。

原始问题

AVSpeechSynthesisVoice.speechVoices() 报告说,当我在装有 iOS 13 GM 的设备上运行它时,没有可用的声音。事实上,当我尝试使用AVSpeechSynthesisVoice(identifier:) 加载语音时,它总是返回 nil。它在模拟器中工作。我不认为这是以前的 beta 版本的问题,它似乎适用于 iOS 13.1 beta 2 和 3。

有没有人遇到过这种情况,并想出了任何解决方法?我没有看到任何有意更改此行为的文档,因此我怀疑这是一个错误。我打算提交雷达。但这对即将发布的 iOS 13 没有帮助。

在新创建的 Single View 项目中可以重现此行为,并将以下琐碎的 viewDidLoad 函数添加到包含的视图控制器中。

override func viewDidLoad() {
    super.viewDidLoad()

    let voices = AVSpeechSynthesisVoice.speechVoices()
    print("Voice Count: \(voices.count)")
}

输出很长:

2019-09-11 10:43:09.370992-0400 SpeechTest[1617:412065] Creating client/daemon connection: C591307C-313E-4B5F-91A8-184B7E662819
2019-09-11 10:43:09.396250-0400 SpeechTest[1617:412065] Got the query meta data reply for: com.apple.MobileAsset.MacinTalkVoiceAssets, response: 0
2019-09-11 10:43:09.397519-0400 SpeechTest[1617:412065] Consumed extension
2019-09-11 10:43:09.401982-0400 SpeechTest[1617:412065] Got the query meta data reply for: com.apple.MobileAsset.MacinTalkVoiceAssets, response: 0
Voice Count: 0
2019-09-11 10:43:09.435890-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServicesVocalizerVoice, response: 0
2019-09-11 10:43:09.445269-0400 SpeechTest[1617:412066] Consumed extension
2019-09-11 10:43:09.468849-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServicesVocalizerVoice, response: 0
2019-09-11 10:43:09.499573-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServicesVocalizerVoice, response: 0
2019-09-11 10:43:09.520244-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServices.GryphonVoice, response: 0
2019-09-11 10:43:09.545243-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServices.CustomVoice, response: 0
2019-09-11 10:43:09.549941-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServices.CombinedVocalizerVoices, response: 2
2019-09-11 10:43:09.550075-0400 SpeechTest[1617:412066] [AXTTSCommon] Error running custom voice query XML not present
2019-09-11 10:43:09.569114-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServicesVocalizerVoice, response: 0
2019-09-11 10:43:09.599459-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServicesVocalizerVoice, response: 0
2019-09-11 10:43:09.630763-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServicesVocalizerVoice, response: 0
2019-09-11 10:43:09.650161-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServices.GryphonVoice, response: 0
2019-09-11 10:43:09.666885-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServices.CustomVoice, response: 0
2019-09-11 10:43:09.671279-0400 SpeechTest[1617:412066] Got the query meta data reply for: com.apple.MobileAsset.VoiceServices.CombinedVocalizerVoices, response: 2
2019-09-11 10:43:09.671412-0400 SpeechTest[1617:412066] [AXTTSCommon] Error running custom voice query XML not present
...

它将最后 7 行重复 39 次,大概对应于它应该知道的 39 个声音。

【问题讨论】:

  • @alexander.pan 我刚刚更新了更多信息。您是在什么设备上遇到问题的?您是如何执行更新的?
  • 我的应用程序的许多用户都有这个问题。我已经数过了 140 台设备。所有iOS13。 @ChrisVasselli 你提交了 rada 吗?
  • @MarcinOlawski 我没有。实际上,我还没有看到我的用户发生过这种情况,所以我得出的结论是,这只是我自己的设备进入的一种奇怪状态。我将我的设备恢复到 iOS 13.1 并且从那以后没有发现问题。

标签: avfoundation ios13 avspeechsynthesizer avspeechutterance


【解决方案1】:

我遇到了同样的 AVSpeechUtterance 问题,它似乎随着时间的推移在我的设备上自行解决了。在使用之前崩溃的应用程序或全新安装的应用程序一段时间后,我不再在 iOS 13 或 13.1 上崩溃。

【讨论】:

    【解决方案2】:

    我有同样的问题,我做了什么来解决它:

    1. 转到设置 > 辅助功能 > 口语内容 > 语音 > 英语(取决于您应用的配置)。

      • 我的应用使用 com.apple.ttsbundle.Samantha-compact,所以我下载了 Samantha 和 Samantha(增强版)
    2. 重启 iPad

    现在我可以正常运行我的应用了。

    【讨论】:

      【解决方案3】:

      这并没有使我的应用程序崩溃,但每次声明 AVSpeechSynthesizer 时都会导致内存泄漏。我通过将 AVSpeechSynthesizer 声明为全局变量解决了这个问题

      static let synth = AVSpeechSynthesizer()
      

      【讨论】:

        猜你喜欢
        • 2020-01-22
        • 1970-01-01
        • 2020-01-24
        • 2019-03-15
        • 2013-10-28
        • 2023-03-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多