5

Update

I installed the iOS 13 GM on a different device, and did not encounter this issue. So I'm no longer sure if this is specific to the iOS 13 GM, or something about the way I installed it. On the first device (an iPhone X), I did an upgrade (via the "Option Key + Check for Update Button" in iTunes). On the second device (an iPhone SE), I did a full restore. Not sure yet what caused it to get into this state.

Original Question

AVSpeechSynthesisVoice.speechVoices() reports that there are no voices available when I run it on my device with the iOS 13 GM. And indeed, when I try to load a voice using AVSpeechSynthesisVoice(identifier:) it always returns nil. It works in the simulator. I don't believe this was an issue with the previous betas, and it seems to work in iOS 13.1 beta 2 and 3.

Has anyone encountered this, and figured out any sort of workaround? I don't see any documentation of an intentional change to this behavior, so I suspect this is a bug. I intend to file a radar. But that won't help me for the impending release of iOS 13.

This behavior is reproducible in a newly created Single View project, with the following trivial viewDidLoad function added to the included view controller.

override func viewDidLoad() {
    super.viewDidLoad()

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

The output is very long:

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
...

It repeats those last 7 lines 39 times, presumably corresponding to the 39 voices it's supposed to know about.

Chris Vasselli
  • 13,064
  • 4
  • 46
  • 49
  • @alexander.pan I just updated with a little more info. What device did you encounter the issue on? How did you perform the update? – Chris Vasselli Sep 16 '19 at 13:58
  • Many users of my app have this problem. I have already counted 140 devices. All iOS13. @ChrisVasselli Did you file a rada? – Marcin Olawski Sep 26 '19 at 12:44
  • @MarcinOlawski I haven't. I actually haven't seen any instances of it happening for my users, so I had come to the conclusion that this was just a weird state my own device got into. I restored my device to iOS 13.1 and haven't seen the issue since. – Chris Vasselli Sep 26 '19 at 16:33

3 Answers3

3

I had the same AVSpeechUtterance issue, it appears to have resolved itself over time on my devices. I no longer crash on iOS 13 or 13.1 after some time using the app where it had crashed before, or from a fresh install.

2

I had the same issue, what I did to solve it:

  1. Go to Settings > Accessibility > Spoken Content > Voices > English (depends on your app's config).

    • My app use com.apple.ttsbundle.Samantha-compact so I download Samantha and Samantha (Enhanced)
  2. Reboot iPad

Now I can run my app normally.

thachnb
  • 1,503
  • 10
  • 13
0

This didn't crash my app but caused a memory leak every time AVSpeechSynthesizer was declared. I solved this by declaring the AVSpeechSynthesizer as a global variable

static let synth = AVSpeechSynthesizer()
Dharman
  • 30,962
  • 25
  • 85
  • 135