csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
351 stars 218 forks source link

Crashing on iOS. #31

Closed GiovanniSybot closed 4 years ago

GiovanniSybot commented 4 years ago

The 0.8.0 version is crashing the app sometimes in iOS. Is there any known issue related or something i must do to avoid crashing? Works fine on Android.

sowens-csd commented 4 years ago

No issues I'm aware of right now. What version of iOS is it and do you know at what point it is crashing? While initializing? Listening? Other?

GiovanniSybot commented 4 years ago

Tested on Iphone 6 and 8. It's not always, but when i press the button that triggets listen() method, the app just closes. I'm developing in AndroidStudio, so i can't check any value on iOS.

sowens-csd commented 4 years ago

The iOS version of those two phones? Is this with the example app or with your own app? If it is not with the example app could you try it with the example app and see if you still get crashes?

GiovanniSybot commented 4 years ago

One is iOS13, the other i dont know exactly but is 10+. I have one iPad with iOS9, that the plugin doesn't work, obviously.

GiovanniSybot commented 4 years ago

iOS13 and iOS12 the devices.

GiovanniSybot commented 4 years ago

I'm gonna post some code.

Future\<void> initSpeechState() async { bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener ); if (!mounted) return; setState(() { _hasSpeech = hasSpeech; }); }

void startListening() { if (!_isListening){ lastWords = ""; lastError = ""; speech.listen(onResult: resultListener, localeId: locale, onSoundLevelChange: soundLevelListener);

  setState(() {
    _isListening = true;
  });
}

}

GiovanniSybot commented 4 years ago

RIP formatting.

sowens-csd commented 4 years ago

Can you get a crash log from the iOS device where the error is happening? Settings | Privacy | Analytics & Improvements | Analytics Data. There was an issue that caused an occasional crash when speech availability changed that was resolved in 0.8.0. But you say you're already using that version. Hopefully a crash log will provide some more help.

GiovanniSybot commented 4 years ago

That's all i got from the TestFlight report. The app just closes and nothing shows up.

Dispositivo - iPhone 8 Versão do iOS - 13.3 Bateria - 70% Operadora - Carrier Fuso horário - America/Sao_Paulo Arquitetura - arm64 Tipo de conexão - Wi-Fi Espaço livre no disco - 2,07 GB disponíveis de 59,59 GB Resolução de tela - 375 x 667 pontos

sowens-csd commented 4 years ago

So you don't see a crash log in the on phone analytics? TestFlight doesn't always seem to include the details, not sure why, but they are usually on phone.

GiovanniSybot commented 4 years ago

Where can I find the log? I don't have an iPhone, and i'm not familiar with iOS.

sowens-csd commented 4 years ago

https://www.macobserver.com/tips/quick-tip/how-to-find-app-crash-reports-iphone-ipad/

GiovanniSybot commented 4 years ago

Thanks. Gonna check it as soon as possible.

sowens-csd commented 4 years ago

Any updates?

GiovanniSybot commented 4 years ago

Gonna check today.

GiovanniSybot commented 4 years ago

Did some runs on the iOS12 device, and got no crashes today. But the onSoundLevelChange was not giving any results on iOS, only on Android.

I was not able to test on the iOS13 yet.

sowens-csd commented 4 years ago

Yes, the onSoundLevelChange is currently Android only. Been working on an iOS implementation but getting hung up on low level data access in Swift. Hopefully soon. Let me know when you think it's safe to close this issue.

GiovanniSybot commented 4 years ago

{"app_name":"Runner","app_cohort":"2|date=1581793200000&sf=143503&tid=560c0b5ce136d0ee7ae5217aa2bb726d21194285ad626dd21bc379506e667190&ttype=i","app_version":"1.3.0","timestamp":"2020-02-16 05:40:55.15 -0300","slice_uuid":"8b91e186-acbf-308d-be16-eb4caf55c90a","adam_id":1486661292,"build_version":"78","bundleID":"com.alexianbrothersonline.classroom","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 13.3.1 (17D50)","incident_id":"D0A90CCE-8D5F-41C8-8B1D-E0B6FBCE2567","is_beta":true,"name":"Runner"} Incident Identifier: D0A90CCE-8D5F-41C8-8B1D-E0B6FBCE2567 Beta Identifier: E58B443D-77D1-44B4-9A15-3B8CD54071C4 Hardware Model: iPhone10,4 Process: Runner [1799] Path: /private/var/containers/Bundle/Application/8613CE1A-01BD-4DC9-9D44-E7DD9E9C8D19/Runner.app/Runner Identifier: com.alexianbrothersonline.classroom Version: 78 (1.3.0) AppStoreTools: 11C29 AppVariant: 1:iPhone10,4:13 Beta: YES Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: com.alexianbrothersonline.classroom [845]

Date/Time: 2020-02-16 05:40:54.8347 -0300 Launch Time: 2020-02-16 03:05:55.0338 -0300 OS Version: iPhone OS 13.3.1 (17D50) Release Type: User Baseband Version: 3.03.03 Report Version: 104

Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0

Last Exception Backtrace: (0x19a6caa48 0x19a3f1fa4 0x19a5cce88 0x1a71c1b8c 0x1a71c1afc 0x1a725c888 0x1a7202378 0x1a71f48a8 0x1a72708d4 0x1a7257228 0x1026625a4 0x102663498 0x10265e9c8 0x1028791c4 0x102814c6c 0x10286a74c 0x1028249cc 0x102826644 0x19a64903c 0x19a648d78 0x19a648448 0x19a643584 0x19a642adc 0x1a45e3328 0x19e75063c 0x102540dec 0x19a4cc360)

GiovanniSybot commented 4 years ago

In another iOS device ( iPhone 6 -iOS 12)

{"app_name":"Runner","app_cohort":"2|date=1582045200000&sf=143503&tid=71ea8719ee0cdc1be5ab82750a509ef3312eb186182f29ee8b15574b2315ff8f&ttype=e","app_version":"1.3.0","timestamp":"2020-02-18 14:58:12.04 -0300","slice_uuid":"83a3831f-132c-303b-a28d-7e9df370797c","adam_id":1486661292,"build_version":"79","bundleID":"com.alexianbrothersonline.classroom","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 12.4.5 (16G161)","incident_id":"93B3C3F1-DFF4-4220-9338-672A2562D087","is_beta":true,"name":"Runner"} Incident Identifier: 93B3C3F1-DFF4-4220-9338-672A2562D087 Beta Identifier: 4447B2DA-1904-44DD-99E0-D74D25064E94 Hardware Model: iPhone7,2 Process: Runner [1426] Path: /private/var/containers/Bundle/Application/E2A3EF18-FD87-48B9-98F5-66C1A37A793C/Runner.app/Runner Identifier: com.alexianbrothersonline.classroom Version: 79 (1.3.0) AppStoreTools: 11C29 AppVariant: 1:iPhone7,2:12.2 Beta: YES Code Type: ARM-64 (Native) Role: Non UI Parent Process: launchd [1] Coalition: com.alexianbrothersonline.classroom [655]

Date/Time: 2020-02-18 14:58:11.0906 -0300 Launch Time: 2020-02-18 14:48:34.1915 -0300 OS Version: iPhone OS 12.4.5 (16G161) Baseband Version: 7.80.04 Report Version: 104

Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0

Application Specific Information: abort() called

sowens-csd commented 4 years ago

Thanks for the logs. Is that the complete log? Are these release builds or debug builds? I usually see more stack information, but that could be because I'm usually running debug builds.

I was just re-reading the thread and I'm not clear whether this is the example app or an app that you wrote? I think it's your app? If so could you try the example app on on one of the devices where this is happening?

GiovanniSybot commented 4 years ago

All release builds.

My app.

As i've said before, i don't have an iOS device to test the example, and I'm developing in AndroidStudio, so i have no clue from iOS behavior. I'm testing on iOS when someone here is with the phone available.

GiovanniSybot commented 4 years ago

Full log from latest crash.

Runner-2020-02-18-145812.txt

sowens-csd commented 4 years ago

Thanks the full log is more helpful. I don't see anything that immediately indicates it's related to speech_to_text. In Xcode you could likely load that crash report from TestFlight and see the symbols of the crash stack but other than that I'm not sure how to get more detail out of this. Another approach would be to try the example app on one of the devices that's having a problem and see if you can reproduce it to either rule speech_to_text in or out.

GiovanniSybot commented 4 years ago

Is there a way to 'dispose' the speech? I've noticed on iOS, as the plugin doesn't stop recording when you stop talking, like on Android, so when i return to the page it is still recording. And maybe it was causing a crash in some point... I've already fixed the recording making the speech to cancel when done, but i believe it needs to be closed properly in dispose() method.

sowens-csd commented 4 years ago

Now that's really interesting. I wonder if that could be causing the crash? You should always either cancel or stop the speech before leaving. Let me know if it continues to crash with this change?

There is no dispose required. Once speech is initialized you can't de-initialize or fully dispose of it. In my applications at least I do the initialization as part of the application start-up.

GiovanniSybot commented 4 years ago

I see, ok, now i'm forcing it to stop when you leave the page. Gonna make new features on the app, and next update i make more tests to check the behavior.

GiovanniSybot commented 4 years ago

I see, ok, now i'm forcing it to stop when you leave the page. Gonna make new features on the app, and next update i make more tests to check the behavior.

sowens-csd commented 4 years ago

Thanks, let me know if you see any more crashes.