iOS 10 error kAFAssistantErrorDomain - Ionic 2
Opened this issue · 13 comments
Just create a new ionic 2 project and add your plugin.
On iOS 10 give an error: Error happens, – {type: "error", error: 203}
Mode details:
Error Domain=kAFAssistantErrorDomain Code=203 "Retry" UserInfo={NSLocalizedDescription=Retry, NSUnderlyingError=0x1702441a0 {Error Domain=SiriSpeechErrorDomain Code=1 "(null)"}}
On android works with no problem.
Same error with this plugin: https://github.com/pbakondy/cordova-plugin-speechrecognition
Are you testing on a real device or a simulator?
Ofc on a real device, simulator is not allowed to access the microphone!
Can you provide a sample Ionic 2 app with just the plugin to reproduce the problem? I've never used Ionic 2 and this problem is not present on regular Cordova apps
Give me 20min and i will upload a .rar project here if is ok
sure
Base code: 🔢
/SpeechRecognitionProject/src/pages/home
My steps:
- Create project:
ionic start SpeechRecognitionProject blank --v2
- Add platform: ionic platform add ios
- Add plugin: cordova plugin add https://github.com/macdonst/SpeechRecognitionPlugin
- Deploying to device: http://ionicframework.com/docs/v2/intro/deploying/
To run my project:
- Download http://s000.tinyupload.com/?file_id=52099303334512887151 or https://files.fm/u/mmpqdbsc (even with a .zip, git says that don’t support that file type...)
- npm install
- ionic platform add ios
- Deploying to device: http://ionicframework.com/docs/v2/intro/deploying/
It should be all 👍
-> If you have error with sass: npm rebuild node-sass
-> If you have error with permission: chmod 777 /Users/*your_profile*/*project_folder*/node_modules/.bin/ionic-app-scripts
Thanks for the project, it was very helpful to test on ionic.
But sadly I don't have any clue, I have tried a few times and I got the 203 once, and also the 209 if I click Start Speech multiple times without waiting for the result, but most times it works fine.
203 is GRAMMAR_LOAD_STATE_FAILURE, 209 is GRAMMAR_LOADING_START_FAILURE (https://developer.nuance.com/public/Help/DragonMobileSDKReference_iOS/Error-codes.html)
Hi @jcesarmobile, thx for your answer.
Have you tested my project or a new one? If a new one, can you kindly share your code? Thx
I tested my project on an iPhone 5s with latest update (iOS 10.2.1).
Tested under Wi-Fi, with airplane mode active.
In this phone, i have a Sim card with no service available, just to unlock the device.
When the recognition starts, near the wifi icon appear a search icon too, idk why.
Today I finally received a recognition back.
But I have to wait like 1min since I stopped talking.
Under Android, as soon as I stop talking, i have a response back.
Now.. How i can handle this?
Thx again.
Yeah, I have to look if it's possible to control the time of the recognition, it's 1 minute as you say.
You can set interimResults to true, so it return results as soon as they are recognized instead of waiting for the whole minute to finish, but will continue with the recognition until the minute runs out. Maybe you can call stop as soon as you get the first result.
Now is working! This is a good workaround for now!
@jcesarmobile, if you can solve this little bug (1min waiting on iOS), it would be perfect!
Thx you!
recognition: any;
constructor(public platform: Platform) {
this.platform.ready().then(() => {
this.recognition = new SpeechRecognition();
this.recognition.lang = 'it';
this.recognition.interimResults = true;
this.recognition.onnomatch = (event => {
console.log('No match found.');
});
this.recognition.onerror = (event => {
console.log('Error happens: ', event);
});
this.recognition.onresult = (event => {
if (event.results.length > 0) {
console.log('Results: ', event.results[0][0].transcript);
this.recognition.stop();
}
});
});
}
speech() {
console.log('Speech start');
this.recognition.start();
}
HI @mosca90 how to solve this problem? i not found your solution?
I got this error also!
Thank!
I'm experiencing the same thing, in Ionic v1 app.
Cordova error:
Error in Error callbackId: SpeechRecognition1097749174 : TypeError: null is not an object (evaluating 'this.observers.length = 0')
callbackFromNative — cordova.js:311
Callback error
"Error Domain=kAFAssistantErrorDomain Code=203 "Retry" UserInfo={NSLocalizedDescription=Retry, NSUnderlyingError=0x1c06477a0 {Error Domain=SiriSpeechErrorDomain Code=1 "(null)"}}"
Or
"Error Domain=kAFAssistantErrorDomain Code=209 "(null)"" = $1
That happens only on IOS devices for me, Android seems to be working just fine.
It seems like the plugin enters a faulted state, If I leave it idle for about 2 minutes it gets back to work....
IOS Version: 11.2.6
cordova: 4.5.4
ionic: 3.6.0
cordova-plugin-speechrecognition: 1.2.0
"Error Domain=kAFAssistantErrorDomain Code=203 "Retry" UserInfo={NSLocalizedDescription=Retry, NSUnderlyingError=0x1c06477a0 {Error Domain=SiriSpeechErrorDomain Code=1 "(null)"}}"
This error means that it failed to recognize the speech.
So you just need to let the users literally RETRY.