flutter_tts icon indicating copy to clipboard operation
flutter_tts copied to clipboard

[AXTTSCommon] Invalid rule on IOS 16

Open Dawid-Dlugosz opened this issue 2 years ago • 10 comments

On android devices all working good, but on iPhone 8 IOS 16 i get this message [AXTTSCommon] Invalid rule: [AXTTSCommon] File file:///var/MobileAsset/AssetsV2/com_apple_MobileAsset_Trial_Siri_SiriTextToSpeech/purpose_auto/763c859a817bf66a99314ef00b97f263806afcf2.asset/AssetData/vocalizer-user-dict.dat contained data that was not null terminated [AXTTSCommon] Invalid rule:

This is my code

class _MyHomePageState extends State<MyHomePage> {

  late FlutterTts _flutterTts;
  @override
  void initState() {
    super.initState();
    initTts();
  }

  void initTts() async {
    _flutterTts = FlutterTts();
    await _flutterTts.awaitSpeakCompletion(true);
  }

  Future speak() async {
    await _flutterTts.setVolume(1);
    await _flutterTts.setSpeechRate(0.5);
    await _flutterTts.setPitch(1);

    await _flutterTts.speak('Speak something');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: TextButton(
            onPressed: speak,
            child: Text('Speak')),
      ),
    );
  }
}

library version: flutter_tts: ^3.6.2

flutter version: Flutter 3.3.8 • channel stable • https://github.com/flutter/flutter.git Framework • revision 52b3dc25f6 (2 weeks ago) • 2022-11-09 12:09:26 +0800 Engine • revision 857bd6b74c Tools • Dart 2.18.4 • DevTools 2.15.0

Dawid-Dlugosz avatar Nov 23 '22 09:11 Dawid-Dlugosz

Hi, I also experienced the error reported by @PeakyCode. The TTS package is still working and the error only shows for me once or twice after I changed the default voice for the language in my iPhone settings (Settings -> Accessibility->Voices->[Japanese]) to a different one (ex. Kyoko (Japanese) to Otoya (Japanese)) . The word/sentence still got spoken but on first execution the error shows up in the console.

Tested on physical iPhone 13 device with iOS 16.1 installed.

tobzilla90 avatar Nov 26 '22 03:11 tobzilla90

I'm getting the same error as @PeakyCode when running on a iPhone SE 2nd gen with iOS 16. @dlutton do we know when it might be possible to have this issue fixed? I understand that it could be a while and developer time may be very limited.

jasonmaclafferty avatar Dec 13 '22 22:12 jasonmaclafferty

@jasonmaclafferty thanks for the info, I'll need to do some research into this issue.

dlutton avatar Dec 14 '22 02:12 dlutton

I'm getting the same error in iOS 16.

frankenstein19 avatar Mar 02 '23 09:03 frankenstein19

I'm having the same issue, also iOS 16. Additionally the sound output is about 5 seconds delayed. During this time, a lot of "Invalid rule" messages appear in the log.

julianbraasch avatar Mar 02 '23 15:03 julianbraasch

I have the same issue on the real device with iOS 16.

[AXTTSCommon] Invalid rule:
[AXTTSCommon] File file:///var/MobileAsset/AssetsV2/com_apple_MobileAsset_Trial_Siri_SiriTextToSpeech/purpose_auto/f52d411b9d92ecd7f55947535cdb7753afe834c3.asset/AssetData/vocalizer-user-dict.dat contained data that was not null terminated

My app has a feature to speak words in the loop. When this feature is used, many [AXTTSCommon] Invalid rule: messages are shown and the app crashes after 15 minutes with the following message. So, I think this issue can cause the app to crash due to memory.

43
[AXTTSCommon] Invalid rule:
* thread #36, name = 'com.apple.TextToSpeech.SpeechThread', queue = 'tts-regex-helper-queue', stop reason = EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=2098 MB, unused=0x0)
    frame #0: 0x00000001addd69b8 CoreFoundation`__CFToUTF8 + 408
CoreFoundation`:
->  0x1addd69b8 <+408>: strb   w19, [x8, #0x2]
    0x1addd69bc <+412>: lsr    w21, w21, #6
    0x1addd69c0 <+416>: mov    w19, #0x80
    0x1addd69c4 <+420>: bfxil  w19, w21, #0, #6
Target 0: (Runner) stopped.

dev-yakuza avatar Mar 15 '23 05:03 dev-yakuza

maybe related to this: https://developer.apple.com/forums/thread/718884

torphix avatar Mar 19 '23 15:03 torphix

I'm experiencing the same issue you mentioned here. The message ([AXTTSCommon] Invalid rule:) keeps popping up while the TTS is speaking. Has anyone figured out how to fix it?

It's only happening on iOS. I'm using: Flutter 3.7.8 flutter_tts 3.6.3 iOS 16.4

Thanks!

BlindDevIE avatar Mar 29 '23 15:03 BlindDevIE

It is affecting me too.

MrOnyszko avatar Aug 22 '23 17:08 MrOnyszko

#311 Solved it for me.

yishaiSilver avatar Feb 02 '24 07:02 yishaiSilver