dlutton / flutter_tts

Flutter Text to Speech package
MIT License
616 stars 258 forks source link

ios close app crash #475

Open TDSSSzero opened 8 months ago

TDSSSzero commented 8 months ago

🐛 Bug Report

After I finished playing TTS voice, when I closed the app, it crashed.

dart use:

late final FlutterTts _tts;
  void _ttsInit(){
    _tts = FlutterTts();
    _tts.setStartHandler(() {
      state.ttsState = TtsState.playing;
    });
    _tts.setCompletionHandler(() {
      state.ttsState = TtsState.stopped;
    });
    _tts.setErrorHandler((msg) {
      state.ttsState = TtsState.stopped;
    });
    _tts.setCancelHandler((){
      state.ttsState = TtsState.stopped;
    });
  }

  Future<bool> _ttsSpeak() async {
    if(state.ttsState == TtsState.playing){
      await _tts.stop();
    }
    String vs = state.mmkv.decodeString(MKey.stringTTSVoice) ?? "50";//some number 0-100
    double voice = double.tryParse(vs) ?? 50;
    double volume = double.tryParse((voice / 100).toStringAsFixed(1)) ?? 50;
    await _tts.setVolume(volume);
    await _tts.setLanguage(Get.locale?.languageCode ?? "en");
    Log().i("tts volume : $volume");
    int res = await _tts.speak(state.quoteStringList[state.pageIndex]);
    bool isPlaying = res == 1;
    if (isPlaying) {
      // SmartDialog.showToast('play success !');
    }
    return isPlaying;
  }

look the 29 line.Maybe it is key point. This is the stack when it crashes:

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x9904c __exceptionPreprocess
1  libobjc.A.dylib                0x15f54 objc_exception_throw
2  Foundation                     0x1306cc _userInfoForFileAndLine
3  Flutter                        0x103f8 (缺少 UUID 4c4c441655553144a141563ec5008ebf)
4  Flutter                        0x5d73b0 (缺少 UUID 4c4c441655553144a141563ec5008ebf)
5  audioplayers_darwin            0x9d90 (缺少 UUID 6130e6ac365b366baa336a334e764380)
6  audioplayers_darwin            0x134e4 (缺少 UUID 6130e6ac365b366baa336a334e764380)
7  audioplayers_darwin            0x12a68 (缺少 UUID 6130e6ac365b366baa336a334e764380)
8  audioplayers_darwin            0x12abc (缺少 UUID 6130e6ac365b366baa336a334e764380)
9  AVFCore                        0xc46c -[AVPeriodicTimebaseObserver _fireBlockForTime:]
10 AVFCore                        0xb459c __68-[AVPeriodicTimebaseObserver initWithTimebase:interval:queue:block:]_block_invoke_4
11 libdispatch.dylib              0x4660 _dispatch_client_callout
12 libdispatch.dylib              0x7b34 _dispatch_continuation_pop
13 libdispatch.dylib              0x1ac38 _dispatch_source_invoke
14 libdispatch.dylib              0x12ab4 _dispatch_main_queue_callback_4CF
15 CoreFoundation                 0x51cd4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
16 CoreFoundation                 0xbeac __CFRunLoopRun
17 CoreFoundation                 0x1f3b8 CFRunLoopRunSpecific
18 TextToSpeechBundleSupport      0x1c190 -[TTSSpeechServerInstance dealloc]
19 TextToSpeech                   0xf98c TTSSpeechUnitTestingMode
20 libAXSpeechManager.dylib       0xb2f4 -[AXSpeechManager .cxx_destruct]
21 libobjc.A.dylib                0x7f18 object_cxxDestructFromClass(objc_object*, objc_class*)
22 libobjc.A.dylib                0x4c14 objc_destructInstance
23 libobjc.A.dylib                0xe338 _objc_rootDealloc
24 libAXSpeechManager.dylib       0x3e04 -[AXSpeechManager dealloc]
25 libobjc.A.dylib                0x23dc _object_remove_assocations
26 libobjc.A.dylib                0x4c24 objc_destructInstance
27 libobjc.A.dylib                0xe338 _objc_rootDealloc
28 AXSpeechImplementation         0x2bd8 -[AVSpeechSynthesizer(Implementation) dealloc]
**29 Runner                         0x20e910c @objc SwiftFlutterTtsPlugin.__ivar_destroyer (SwiftFlutterTtsPlugin.swift)**
30 libobjc.A.dylib                0x7f18 object_cxxDestructFromClass(objc_object*, objc_class*)
31 libobjc.A.dylib                0x4c14 objc_destructInstance
32 libobjc.A.dylib                0xe338 _objc_rootDealloc
33 libsystem_blocks.dylib         0x17e8 _Block_release
34 Flutter                        0x47ddc (缺少 UUID 4c4c441655553144a141563ec5008ebf)
35 libsystem_blocks.dylib         0x17e8 _Block_release
36 Flutter                        0x37b98 (缺少 UUID 4c4c441655553144a141563ec5008ebf)
37 Flutter                        0x37b48 (缺少 UUID 4c4c441655553144a141563ec5008ebf)
38 Flutter                        0x36ecc (缺少 UUID 4c4c441655553144a141563ec5008ebf)
39 Flutter                        0x3e4250 (缺少 UUID 4c4c441655553144a141563ec5008ebf)
40 Flutter                        0x12100 (缺少 UUID 4c4c441655553144a141563ec5008ebf)
41 Flutter                        0xd654 (缺少 UUID 4c4c441655553144a141563ec5008ebf)
42 CoreFoundation                 0x2aed8 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
43 CoreFoundation                 0xc6b8c ___CFXRegistrationPost_block_invoke
44 CoreFoundation                 0x99f44 _CFXRegistrationPost
45 CoreFoundation                 0x40d44 _CFXNotificationPost
46 Foundation                     0x1a628 -[NSNotificationCenter postNotificationName:object:userInfo:]
47 UIKitCore                      0xf50e9c -[UIApplication _terminateWithStatus:]
48 UIKitCore                      0x63bd14 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
49 UIKitCore                      0x830c5c -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:]
50 UIKitCore                      0xf4dae4 -[UIApplication workspaceShouldExit:withTransitionContext:]
51 FrontBoardServices             0x4fc38 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2
52 FrontBoardServices             0xa6b4 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
53 FrontBoardServices             0x4fbd0 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke
54 libdispatch.dylib              0x4660 _dispatch_client_callout
55 libdispatch.dylib              0x8118 _dispatch_block_invoke_direct
56 FrontBoardServices             0xbf94 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
57 FrontBoardServices             0xb3d4 -[FBSSerialQueue _targetQueue_performNextIfPossible]
58 FrontBoardServices             0xf9e4 -[FBSSerialQueue _performNextFromRunLoopSource]
59 CoreFoundation                 0xbb020 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
60 CoreFoundation                 0xcbce0 __CFRunLoopDoSource0
61 CoreFoundation                 0x5fe8 __CFRunLoopDoSources0
62 CoreFoundation                 0xb7f4 __CFRunLoopRun
63 CoreFoundation                 0x1f3b8 CFRunLoopRunSpecific
64 GraphicsServices               0x138c GSEventRunModal
65 UIKitCore                      0x5196a8 -[UIApplication _run]
66 UIKitCore                      0x2987f4 UIApplicationMain
67 Runner                         0x1ca28 main + 11 (AppDelegate.swift:11)

Configuration

Version: 3.8.3

Platform: iphone: 13 iOS:15.1

binSaed commented 1 month ago

Same issue

          Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0xa248 __exceptionPreprocess
1  libobjc.A.dylib                0x17a68 objc_exception_throw
2  Foundation                     0x54681c _userInfoForFileAndLine
3  Flutter                        0x1ba6c (Missing UUID 4c4c44c655553144a12489c324693308)
4  Flutter                        0x5d5c9c (Missing UUID 4c4c44c655553144a12489c324693308)
5  audio_session                  0x7fc0 (Missing UUID 97bf58113a973e36935f519b86f13646)
6  audio_session                  0x7d8c (Missing UUID 97bf58113a973e36935f519b86f13646)
7  CoreFoundation                 0x377c4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
8  CoreFoundation                 0xde75c ___CFXRegistrationPost_block_invoke
9  CoreFoundation                 0xc1a34 _CFXRegistrationPost
10 CoreFoundation                 0x4bdc8 _CFXNotificationPost
11 Foundation                     0x5c4dc -[NSNotificationCenter postNotificationName:object:userInfo:]
12 AudioSession                   0x1c644 __63-[AVAudioSession privatePostNotificationForType:name:userInfo:]_block_invoke
13 libdispatch.dylib              0x24b4 _dispatch_call_block_and_release
14 libdispatch.dylib              0x3fdc _dispatch_client_callout
15 libdispatch.dylib              0x127f4 _dispatch_main_queue_drain
16 libdispatch.dylib              0x12444 _dispatch_main_queue_callback_4CF
17 CoreFoundation                 0x9aa08 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
18 CoreFoundation                 0x7c368 __CFRunLoopRun
19 CoreFoundation                 0x811e4 CFRunLoopRunSpecific
20 TextToSpeechBundleSupport      0x187b0 -[TTSSpeechServerInstance terminateSpeechThread]
21 TextToSpeechBundleSupport      0x1e69c -[TTSSpeechServer synthesizerInstanceDestroyed:]
22 TextToSpeech                   0x24274 TTSSpeechUnitTestingMode
23 libAXSpeechManager.dylib       0x10e80 -[AXSpeechManager .cxx_destruct]
24 libobjc.A.dylib                0x14a4 object_cxxDestructFromClass(objc_object*, objc_class*)
25 libobjc.A.dylib                0x621c objc_destructInstance
26 libobjc.A.dylib                0xf9d0 _objc_rootDealloc
27 libAXSpeechManager.dylib       0x5dec -[AXSpeechManager dealloc]
28 libobjc.A.dylib                0x313fc _object_remove_associations
29 libobjc.A.dylib                0x622c objc_destructInstance
30 libobjc.A.dylib                0xf9d0 _objc_rootDealloc
31 AXSpeechImplementation         0x6ac0 -[AVSpeechSynthesizer(Implementation_Shared) dealloc]
32 Runner                         0x220aa80 @objc SwiftFlutterTtsPlugin.__ivar_destroyer (SwiftFlutterTtsPlugin.swift)
33 libobjc.A.dylib                0x14a4 object_cxxDestructFromClass(objc_object*, objc_class*)
34 libobjc.A.dylib                0x621c objc_destructInstance
35 libobjc.A.dylib                0xf9d0 _objc_rootDealloc
36 libsystem_blocks.dylib         0x2124 _call_dispose_helpers_excp
37 libsystem_blocks.dylib         0x1d54 _Block_release
38 Flutter                        0x54a58 (Missing UUID 4c4c44c655553144a12489c324693308)
39 libsystem_blocks.dylib         0x2124 _call_dispose_helpers_excp
40 libsystem_blocks.dylib         0x1d54 _Block_release
41 Flutter                        0x43d64 (Missing UUID 4c4c44c655553144a12489c324693308)
42 Flutter                        0x43d14 (Missing UUID 4c4c44c655553144a12489c324693308)
43 Flutter                        0x430bc (Missing UUID 4c4c44c655553144a12489c324693308)
44 Flutter                        0x3dc6a8 (Missing UUID 4c4c44c655553144a12489c324693308)
45 Flutter                        0x1d7f0 (Missing UUID 4c4c44c655553144a12489c324693308)
46 Flutter                        0x18bb8 (Missing UUID 4c4c44c655553144a12489c324693308)
47 CoreFoundation                 0x377c4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
48 CoreFoundation                 0xde75c ___CFXRegistrationPost_block_invoke
49 CoreFoundation                 0xc1a34 _CFXRegistrationPost
50 CoreFoundation                 0x4bdc8 _CFXNotificationPost
51 Foundation                     0x5c4dc -[NSNotificationCenter postNotificationName:object:userInfo:]
52 UIKitCore                      0xd2ec0c -[UIApplication _terminateWithStatus:]
53 UIKitCore                      0x2914b4 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
54 UIKitCore                      0x6a671c -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:]
55 UIKitCore                      0xd2b07c -[UIApplication workspaceShouldExit:withTransitionContext:]
56 FrontBoardServices             0x41680 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2
57 FrontBoardServices             0x6ae4 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
58 FrontBoardServices             0x41620 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke
59 libdispatch.dylib              0x3fdc _dispatch_client_callout
60 libdispatch.dylib              0x7a5c _dispatch_block_invoke_direct
61 FrontBoardServices             0x10f2c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
62 FrontBoardServices             0x10ac8 -[FBSSerialQueue _targetQueue_performNextIfPossible]
63 FrontBoardServices             0x132a8 -[FBSSerialQueue _performNextFromRunLoopSource]
64 CoreFoundation                 0xd622c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
65 CoreFoundation                 0xe2614 __CFRunLoopDoSource0
66 CoreFoundation                 0x6657c __CFRunLoopDoSources0
67 CoreFoundation                 0x7beb8 __CFRunLoopRun
68 CoreFoundation                 0x811e4 CFRunLoopRunSpecific
69 GraphicsServices               0x1368 GSEventRunModal
70 UIKitCore                      0x3a2d88 -[UIApplication _run]
71 UIKitCore                      0x3a29ec UIApplicationMain
72 Runner                         0x9c38 main + 11 (AppDelegate.swift:11)
73 ???                            0x1a8631948 (Missing)