Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 10 error kAFAssistantErrorDomain - Ionic 2 #88

Open
ghost opened this issue Feb 21, 2017 · 13 comments
Open

iOS 10 error kAFAssistantErrorDomain - Ionic 2 #88

ghost opened this issue Feb 21, 2017 · 13 comments

Comments

@ghost
Copy link

ghost commented Feb 21, 2017

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

@ghost ghost changed the title iOS 10 error iOS 10 error kAFAssistantErrorDomain Feb 21, 2017
@jcesarmobile
Copy link
Collaborator

Are you testing on a real device or a simulator?

@ghost
Copy link
Author

ghost commented Feb 21, 2017

Ofc on a real device, simulator is not allowed to access the microphone!

@jcesarmobile
Copy link
Collaborator

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

@ghost
Copy link
Author

ghost commented Feb 21, 2017

Give me 20min and i will upload a .rar project here if is ok

@jcesarmobile
Copy link
Collaborator

sure

@ghost
Copy link
Author

ghost commented Feb 21, 2017

Base code: 🔢
/SpeechRecognitionProject/src/pages/home

My steps:

To run my project:

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

@jcesarmobile
Copy link
Collaborator

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)

@ghost
Copy link
Author

ghost commented Feb 23, 2017

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.

@jcesarmobile
Copy link
Collaborator

jcesarmobile commented Feb 23, 2017

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.

@ghost
Copy link
Author

ghost commented Feb 23, 2017

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();
}

@ghost ghost changed the title iOS 10 error kAFAssistantErrorDomain iOS 10 error kAFAssistantErrorDomain - Ionic 2 Feb 23, 2017
@ButhSitha
Copy link

HI @mosca90 how to solve this problem? i not found your solution?
I got this error also!

Thank!

@Pavel-Durov
Copy link

Pavel-Durov commented Mar 22, 2018

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

@hezhk3
Copy link

hezhk3 commented Nov 6, 2018

"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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants