AVSpeechSynthesizer is broken on iOS 17 in Xcode 15

When you initialize AVSpeechSynthesizer as View prorety in SwiftUI project in Xcode 15 with iOS 17 simulator, you get some comments in console:

Failed to get sandbox extensions
Query for com.apple.MobileAsset.VoiceServicesVocalizerVoice failed: 2
#FactoryInstall Unable to query results, error: 5
Unable to list voice folder
Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2
Unable to list voice folder
Unable to list voice folder
Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2
Unable to list voice folder

When you try to run utterance inside a Button as synthesizer.speak(AVSpeechUtterance(string: "iOS 17 broke TextToSpeech")), you get endless stream of warnings that repeaths on and on in console like this:

AddInstanceForFactory: No factory registered for id <CFUUID 0x60000024f200> F8BB1C28-BAE8-11D6-9C31-00039315CD46
Cannot find executable for CFBundle 0x600003b2cd20 </Library/Developer/CoreSimulator/Volumes/iOS_21A328/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextToSpeechMauiSupport.framework> (not loaded)
Failed to load first party audio unit from TextToSpeechMauiSupport.framework
Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain Code=-3000 "(null)"
Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain Code=-3000 "(null)"
Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain Code=-3000 "(null)"
Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain Code=-3000 "(null)"
Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain Code=-3000 "(null)"
Couldn't find audio unit for request SSML Length: 40, Voice: [AVSpeechSynthesisProviderVoice 0x600002127e30] Name: Samantha, Identifier: com.apple.voice.compact.en-US.Samantha, Supported Languages (
    "en-US"
), Age: 0, Gender: 0, Size: 0, Version: (null)
VoiceProvider: Could not start synthesis for request SSML Length: 40, Voice: [AVSpeechSynthesisProviderVoice 0x600002127e30] Name: Samantha, Identifier: com.apple.voice.compact.en-US.Samantha, Supported Languages (
    "en-US"
), Age: 0, Gender: 0, Size: 0, Version: (null), converted from tts request [TTSSpeechRequest 0x600003709680] iOS 17 broke TextToSpeech language: en-US footprint: compact rate: 0.500000 pitch: 1.000000 volume: 1.000000
Failed to speak request with error: Error Domain=TTSErrorDomain Code=-4010 "(null)". Attempting to speak again with fallback identifier: com.apple.voice.compact.en-US.Samantha

CPU is under pressure (more than 100%). AVSpeechSynthesizer doesn't speak. All works fine on iOS 16.

The code of View:

import SwiftUI
import AVFoundation

struct ContentView: View {
    let synthesizer = AVSpeechSynthesizer()
    
    var body: some View {
        VStack {
            Button {
                synthesizer.speak(AVSpeechUtterance(string: "iOS 17 broke TextToSpeech"))
            } label: {
                Text("speak")
            }
            .buttonStyle(.borderedProminent)

        }
        .padding()
    }
}

#Preview {
    ContentView()
}

On the real device nothing at all happened.

The same happens to my production app. I have so much crashes related to TextToSpeach and iOS 17. What's going on?

Check out these related threads:

https://developer.apple.com/forums/thread/730639?answerId=765237022#765237022

https://developer.apple.com/forums/thread/737685

-- Appears every app using AVSpeechSynthesizer has undefined behavior on iOS 17. This is blocking me from pushing an update I've been working on for months.

If you run Scheme on a device with "Adress sanitizer" connected, it crashes when trying to play something through AVSpeechSynthesizer.

AddressSanitizer: attempting free on address which was not malloc()-ed: 0x00013fd04080

Address 0x00013fd04080 is a wild pointer inside of access range of size 0x000000000001. 
SUMMARY: AddressSanitizer: bad-free

And this is even in a completely empty application with only one button, synthesizer and an attempt to speak() something.

Yea. It's a pretty bad situation for us. Doesn't seem like there is anything we can do about...except wait and hope they'll fix it soon.

Well, checking on Xcode Version 15.0 (15A240d), and behavior is like this: I see this in the log: #FactoryInstall Unable to query results, error: 5 Unable to list voice folder Unable to list voice folder Unable to list voice folder Unable to list voice folder Unable to list voice folder Unable to list voice folder Unable to list voice folder Unable to list voice folder Unable to list voice folder Unable to list voice folder

-you have to have patience if you have enabled breakpoints and active debug session, because you need to pass 12 exceptions

-if you are lucky and xcode does not freeze, you will eventually hear the sound.

So the best at the moment is to switch off breakpoints for "Swift Error" (delete it from list of breakpoints)

Not ideal, but it works for now. I filled the bug report.

Faced the same issue and tried changing the voice from samantha to fred and that worked for me. Ref: https://developer.apple.com/forums/thread/735618

That probably is just a band aid. I'm noticing all sorts of strange behavior where speech synthesizer just stops for certain voices and not others, for certain speech strings and not others.

Version 15.0 beta 8 same thing here. On iPhone 13 Pro Max pushed from Testflight is fine.

Similar situation still waiting for fix to publish my app :

Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain Code=-3000 "(null)" Couldn't find audio unit for request SSML Length: 54, Voice: [AVSpeechSynthesisProviderVoice 0x60000219d810] Name: Anna, Identifier: com.apple.voice.super-compact.de-DE.Anna, Supported Languages ( "de-DE" ), Age: 0, Gender: 0, Size: 0, Version: (null) VoiceProvider: Could not start synthesis for request SSML Length: 54, Voice: [AVSpeechSynthesisProviderVoice 0x60000219d810] Name: Anna, Identifier: com.apple.voice.super-compact.de-DE.Anna, Supported Languages ( "de-DE" ), Age: 0, Gender: 0, Size: 0, Version: (null), converted from tts request [TTSSpeechRequest 0x600003705e00] zugehen language: de-DE footprint: super-compact rate: 0.400000 pitch: 1.000000 volume: 1.000000

Anyone else file a bug and if so did anyone from Apple reply? I think a lot of apps use AVSpeechSynthesizer so hopefully they give the issue priority,. I ended up opening a TSI last week but still haven't heard back yet. My app release is completely jammed up.

We have also been facing this issue for weeks and have yet to find a workaround. Moreover, we are experiencing crashes on real devices running iOS 17 through 17.0.2.

I have created a FB and opened another TSI, but am still awaiting feedback.

Has anyone checked to see if this issue has been resolved in the 17.1 beta?

@dw_dw My TSI got credited back to my account and they said there is "no workaround" and the issue is being investigated.

I was wondering the same thing about 17.1 beta but haven't checked it out myself.

Sidenode for whatever reason e-mail notifications aren't working for me on this thread even though I'm watching it. Have to check back manually periodically to see if anyone is posting here.

I'm developing a React Native application with the usage of React Native TTS package for text to speech functionality. After upgrading to XCode 15 and IOS 17, I've encountered on the issue that produces the same errors as described here. My "Samantha" voice id was unable to speak after the update and I followed some steps here that produced exactly the same outputs in my case (switching to Fred worked but it didn't solve my case because I need female voice). I've used simulators with the IOS 17.0 system.

Today I've upgraded my Iphone SE (2nd generation) to IOS 17.0.2 and I tested it and it was all working as before! So in my case it seems that testing the functionality on XCode 15 simulators with IOS 17.0 was unsuccessful, and I got success when testing it on the real device with the latest IOS system version (17.0.2), which seems to resolvee this issue at least in my case.

So I suggest anyone to try it on a real device with the system version higher than IOS 17.0. Cheers!

I'm on iOS 17.0.3 and still am still seeing all the same issues with AVSpeechSynthesizer.

The reason why certain voices seem to work while others don't is due to the nature of undefined behavior. All sorts of random and bad stuff can happen in unpredictable ways. The issue does not seem to be fixed.

Hello All, I am having very similar errors like the first original post since I updated to XCODE 15 and simulating on iOS 17.x.x. I did NOT have issues related to Text to Speech while I was working on XCODE 14.3.1 and simulating on iOS 16.4 before the update in development and in production.

Here are the errors I am getting from XCODE 15 simulating on iOS 17.x.x. The simulator freezes and I receive below errors:

Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Unable to list voice folder Unable to list voice folder Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Unable to list voice folder Query for com.apple.MobileAsset.VoiceServicesVocalizerVoice failed: 2 Unable to list voice folder Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Unable to list voice folder 1 log/signpost messages lost due to high rates in live mode recording. To guarantee delivery of all logs, set IDELogRedirectionPolicy to oslogToStdio in the environment of the executable. Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Unable to list voice folder 1 log/signpost messages lost due to high rates in live mode recording. To guarantee delivery of all logs, set IDELogRedirectionPolicy to oslogToStdio in the environment of the executable. ...

Followed by tens of thousands of these errors:

Couldn't find audio unit for request SSML Length: 17, Voice: [AVSpeechSynthesisProviderVoice 0x600006417520] Name: Tingting, Identifier: com.apple.voice.super-compact.zh-CN.Tingting, Supported Languages ( "zh-CN" ), Age: 0, Gender: 0, Size: 0, Version: (null) VoiceProvider: Could not start synthesis for request SSML Length: 17, Voice: [AVSpeechSynthesisProviderVoice 0x600006417520] Name: Tingting, Identifier: com.apple.voice.super-compact.zh-CN.Tingting, Supported Languages ( "zh-CN" ), Age: 0, Gender: 0, Size: 0, Version: (null), converted from tts request [TTSSpeechRequest 0x600013722040] 能够 language: zh-CN footprint: super-compact rate: 0.500000 pitch: 1.000000 volume: 1.000000 Failed to speak request with error: Error Domain=TTSErrorDomain Code=-4010 "(null)". Attempting to speak again with fallback identifier: com.apple.voice.compact.en-US.Samantha Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain Code=-3000 "(null)" Couldn't find audio unit for request SSML Length: 19, Voice: [AVSpeechSynthesisProviderVoice 0x60000641fac0] Name: Samantha, Identifier: com.apple.voice.compact.en-US.Samantha, Supported Languages ( "en-US" ), Age: 0, Gender: 0, Size: 0, Version: (null) VoiceProvider: Could not start synthesis for request SSML Length: 19, Voice: [AVSpeechSynthesisProviderVoice 0x60000641fac0] Name: Samantha, Identifier: com.apple.voice.compact.en-US.Samantha, Supported Languages ( "en-US" ), Age: 0, Gender: 0, Size: 0, Version: (null), converted from tts request [TTSSpeechRequest 0x600013730000] able language: en-US footprint: compact rate: 0.500000 pitch: 1.000000 volume: 1.000000 Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain Code=-3000 "(null)" ... Couldn't find audio unit for request SSML Length: 17, Voice: [AVSpeechSynthesisProviderVoice 0x6000064219f0] Name: Tingting, Identifier: com.apple.voice.super-compact.zh-CN.Tingting, Supported Languages ( "zh-CN" ), Age: 0, Gender: 0, Size: 0, Version: (null) VoiceProvider: Could not start synthesis for request SSML Length: 17, Voice: [AVSpeechSynthesisProviderVoice 0x6000064219f0] Name: Tingting, Identifier: com.apple.voice.super-compact.zh-CN.Tingting, Supported Languages ( "zh-CN" ... ... 1 log/signpost messages lost due to high rates in live mode recording. To guarantee delivery of all logs, set IDELogRedirectionPolicy to oslogToStdio in the environment of the executable. Failed to speak request with error: Error Domain=TTSErrorDomain Code=-4010 "(null)". Attempting to speak again with fallback identifier: com.apple.voice.compact.zh-CN.Tingting Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain Code=-3000 "(null)" Couldn't find audio unit for request SSML Length: 19, Voice: [AVSpeechSynthesisProviderVoice 0x60000641ec60] Name: Samantha, Identifier: com.apple.voice.compact.en-US.Samantha, Supported Languages ( "en-US" ), Age: 0, Gender: 0, Size: 0, Version: (null)

So I moved back to XCODE 14.3.1 simulating on iOS 16.4. The app works fine but I receive these messages:

… [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=Ne-\Yo, message=unrecognized character follows , characterPosition=4 … [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=rlst/yosemite/set/mnc, contentType=application/x-vocalizer-rettt+text;loader=broker, lhError=88602000 … [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2 … [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2 … changing items while animating can result in a corrupted navigation bar … … [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=Ne-\Yo, message=unrecognized character follows , characterPosition=4 … [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=rlst/yosemite/set/mnc, contentType=application/x-vocalizer-rettt+text;loader=broker, lhError=88602000 …
… [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=Ne-\Yo, message=unrecognized character follows , characterPosition=4 … [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=rlst/yosemite/set/mnc, contentType=application/x-vocalizer-rettt+text;loader=broker, lhError=88602000 … [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2 … … [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=Ne-\Yo, message=unrecognized character follows , characterPosition=4 … [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=rlst/yosemite/set/mnc, contentType=application/x-vocalizer-rettt+text;loader=broker, lhError=88602000

Now the app store production version freezes in any device running 17.x.x and not usable anymore. I opened a case with Apple development team but I have not received a reply yet. The zh-CN.Tingting, and en-US.Samantha keep repeating over 350,000 times each in the errors.

It also seems that I am receiving: … [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2 Without affecting the app in XCODE 14.x.

And a similar error: Query for com.apple.MobileAsset.VoiceServicesVocalizerVoice failed: 2 Unable to list voice folder Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Unable to list voice folder In XCODE 15.

Any help will be highly appreciated to find a quick work around or a fix. Thanks

Nothing in the iOS 17.1 Beta 2 Release Notes regarding AVFoundation. Anyone try the Beta?

AVSpeechSynthesizer is broken on iOS 17 in Xcode 15
 
 
Q