In one of my Apps I'm using AVSpeechSynthesizer let the watch speak text to the user, which works great in general, but not when selecting a German voice (the only one that is available under watchOS 6,1,1 is "Anna-compact"). With the German voice to sperak German text, that App always crashes under watchOS 6.1.1 (it did not crash under watchOS 5, and I think not under early watchOS 6 releases, though I can't really tell when this issue started).
The code which starts the speech output is simple:
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text]; utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"de"]; [self.speechSynthesizer speakUtterance:utterance];
The crash happens within the speakUtterance call, the App never returns from this call, also none of the delegeta methods of AVSpeechSynthesizer is ever called here, so the crash occurs while the watchOS initializes its internal data structures.
The watchOS throws this exception:
EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=80 MB, unused=0x0)
and is crashing here (deep within the TTS component of watchOS):
|#0||0x1c4f370c in __CFToUTF8 ()|
|#1||0x1c586f48 in __CFStringEncodeByteStream ()|
|#2||0x1ceee8a4 in -[NSString(NSStringOtherEncodings) getBytes:maxLength:usedLength:encoding:options:range:remainingRange:] ()|
|#3||0x1cffdecc in _NS_os_log_callback ()|
|#4||0x1c1e538c in _os_log_fmt_flatten_NSCF ()|
|#5||0x1c1e4c10 in _os_log_fmt_flatten_object ()|
|#6||0x1c1f1308 in _os_log_impl_flatten_and_send ()|
|#7||0x1c1f0bec in _os_log ()|
|#8||0x1c1f6b90 in _os_log_debug_impl ()|
|#9||0x3fbb466c in -[TTSRegexHelper _addRules:] ()|
|#10||0x1bf945a8 in _dispatch_client_callout ()|
|#11||0x1bfa0eb8 in _dispatch_lane_barrier_sync_invoke_and_complete ()|
|#12||0x3fbb4368 in -[TTSRegexHelper addRules:] ()|
|#13||0x04ecb050 in ___lldb_unnamed_symbol8$$TTSSpeechBundle ()|
|#14||0x3fbc79ac in -[TTSVocalizer loadResource:mimeType:resourceURL:supportsAccurateWordCallbacks:] ()|
|#15||0x3fbc4d4c in -[TTSSpeechServerInstance _loadVoiceResource:voiceResource:] ()|
|#16||0x3fbc4960 in -[TTSSpeechServerInstance _initializeSpeechEngine:] ()|
|#17||0x3fbc4b7c in -[TTSSpeechServerInstance _initializeSpeech:] ()|
|#18||0x3fbc260c in -[TTSSpeechServerInstance _processCurrentRequest:] ()|
|#19||0x3fbc3704 in -[TTSSpeechServerInstance _handleSpeechThread] ()|
|#20||0x3fbc25c0 in _SpeechThread ()|
|#21||0x1c1cc930 in _pthread_start ()|
I've no idea if this is a general issue/bug of watchOS 6.1.1 (it comes with damaged/broken voice files for German), or if only something on my watch got damaged for some unknown reason.
Has anyone any experience in using AVSpeechSynthesizer on the AppleWatch and can reproduce this crash when using the German voice? Does it work under watchOS 6.1.1 on other devices?
The text itself which should be read can not be the problem, because it crashes even with the text "1 2 3" (counting to 3), so no special characters (umlaut) or other fancy things involved. As test case "1 2 3" works great because this same text can be used for all languages and voices in the same way.