Сбои TTS в iOS 13 - невозможно найти ресурс `lang '[kLanguage] - (AVSpeechSynthesisVoice, AVSpeechUtterance) - PullRequest
1 голос
/ 05 октября 2019

Мы наблюдаем странный сбой, вероятно связанный с TTS (Fatal Exception: std :: logic_error: Невозможно найти ресурс `lang '[kLanguage]). Это происходит для меня с разными языками, так что, похоже, в iOS 13 есть некоторые изменения. Возможно, ресурсы TextToSpeech не загружаются вовремя. Есть идеи? Кто-нибудь еще видит этот сбой или лучше знает, как это исправить?

let voices = AVSpeechSynthesisVoice.speechVoices()

for voice in voices {
  if voice.name == storedName {
     synthVoice = voice
     break
  }
}

...

let utterance  = AVSpeechUtterance(string: text)
utterance.voice = self.synthVoice
self.synthesizer.speak(utterance)
Error: Fatal Exception: std::logic_error: Unable to find resource `lang'[kLanguage].

Trace:

8  libc++abi.dylib                0x19c929304 std::__terminate(void (*)()) + 16
9  libc++abi.dylib                0x19c928c58 __cxa_get_exception_ptr + 30
10 libc++abi.dylib                0x19c928c18 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) + 122
11 SiriTTS                        0x19f877894 VoiceConfig::report_error(unsigned int, VoiceConfig::IfMissing, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 960
12 SiriTTS                        0x19f877d88 VoiceConfigImpl::get_json(unsigned int, VoiceConfig::IfMissing) const + 144
13 SiriTTS                        0x19f8e1210 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > VoiceConfig::get_param<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(unsigned int, VoiceConfig::IfMissing) const + 36
14 SiriTTS                        0x19f848490 NashvilleAdapterStream::NashvilleAdapterStream(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool>) + 308
15 SiriTTS                        0x19f8c0158 std::__1::__compressed_pair_elem<NashvilleAdapterStream, 1, false>::__compressed_pair_elem<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool>&, 0ul, 1ul>(std::__1::piecewise_construct_t, std::__1::tuple<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool>&>, std::__1::__tuple_indices<0ul, 1ul>) + 72
16 SiriTTS                        0x19f8c00d0 std::__1::__shared_ptr_emplace<NashvilleAdapterStream, std::__1::allocator<NashvilleAdapterStream> >::__shared_ptr_emplace<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool>&>(std::__1::allocator<NashvilleAdapterStream>, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&&&, std::__1::shared_ptr<SharedObjectPool>&&&) + 40
17 SiriTTS                        0x19f8c0078 std::__1::shared_ptr<NashvilleAdapterStream> std::__1::shared_ptr<NashvilleAdapterStream>::make_shared<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool>&>(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&&&, std::__1::shared_ptr<SharedObjectPool>&&&) + 52
18 SiriTTS                        0x19f8bffd8 std::__1::shared_ptr<Module> std::__1::__invoke_void_return_wrapper<std::__1::shared_ptr<Module> >::__call<void ModuleFactory::ModuleFactoryImpl::register_module<NashvilleAdapterStream>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::'lambda'(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool>)&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool> >(void ModuleFactory::ModuleFactoryImpl::register_module<NashvilleAdapterStream>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::'lambda'(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool>)&&&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&&&, std::__1::shared_ptr<SharedObjectPool>&&) + 48
19 SiriTTS                        0x19f8bdeb4 ModuleFactory::ModuleFactoryImpl::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool>) + 164
20 SiriTTS                        0x19f8bdda4 ModuleFactory::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, std::__1::shared_ptr<SharedObjectPool>) + 60
21 SiriTTS                        0x19f8652e4 GryphonPipelineFactory::pipeline_from_config(std::__1::shared_ptr<SharedObjectPool>, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&) + 472
22 SiriTTS                        0x19f866a84
GryphonPipelineFactory::nashvilleFE_backend_pipeline(std::__1::shared_ptr<SharedObjectPool>) + 1140 23 SiriTTS 0x19f85ffb0 FeatureExtractorTarget::init_with_object_pool(std::__1::shared_ptr, bool) + 924
24 SiriTTS                        0x19f86027c
FeatureExtractorTarget::init_with_install_path(char const*) + 272
25 TTSSpeechBundle                0x110480b50 (Missing)
26 TTSSpeechBundle                0x1104919c4 (Missing)
27 TTSSpeechBundle                0x110491a6c (Missing)
28 TTSSpeechBundle                0x11048ef44 (Missing)
29 TTSSpeechBundle                0x110490514 (Missing)
30 TTSSpeechBundle                0x11048eefc (Missing)
31 libsystem_pthread.dylib        0x19c8781f0 _pthread_start + 124
32 libsystem_pthread.dylib        0x19c87baf0 thread_start + 8
...