pbakondy / cordova-plugin-speechrecognition

:microphone: Cordova Plugin for Speech Recognition
MIT License
196 stars 116 forks source link

error domain=kAFAssistantErrorDomain Code=1101"(null)" #4

Closed hybridapp20161 closed 7 years ago

hybridapp20161 commented 7 years ago

Hi Peter, I am using your plugin in cordova app,it give me error on simulator(error domain=kAFAssitantErrorDomainCode=1101"(null)") and says missing permission in isListening function. Also in device it give me error(error domain=kAFAssitantErrorDomainCode=216"(null)").

Kindly help. Thanks in advance

pbakondy commented 7 years ago

You have to run on a device. The iOS simulator does not have access to your Mac’s microphone.

hybridapp20161 commented 7 years ago

when i run on device it give me this error(error domain=kAFAssitantErrorDomainCode=216"(null)")

pbakondy commented 7 years ago

Did you request permission? What is your environment? cordova, xcode, ios version?

hybridapp20161 commented 7 years ago

yes i have already given these permission (NSMicrophoneUsageDescription permission & NSSpeechRecognitionUsageDescription permission) with its string value in info.plist. My cordova version:6.3.1 xcode:Version 8.0 (8A218a) IOS:OS X EI Capitan..10.11.6 (15G1004)

pbakondy commented 7 years ago

You have to call requestPermission() to get those permissions, info.plist only is not enough.

hybridapp20161 commented 7 years ago

I've already implemented requestPermission() method as shown in below code-

window.plugins.speechRecognition.requestPermission(function(requestpermissionResult){ console.log("Stop message: " + requestpermissionResult); alert("requestPermission::"+requestpermissionResult); }, function(requestpermissionErrorMessage){ console.log("Error message: " + requestpermissionErrorMessage); alert("Error message :requestPermissionError::"+requestpermissionErrorMessage); });

Is this enough or should I have to implement in other way ??

pbakondy commented 7 years ago

You should call it before using startListening(). You should see a popup window of permission request.

hybridapp20161 commented 7 years ago

We are calling it before startListening(). We are getting Popup asking for permission also. After clicking on ok, it goes to startListening method and we get the error domain=kAFAssitantErrorDomainCode=216"(null)").

pbakondy commented 7 years ago

Where do you see this error? Does it come with the error callback of startListening() ? What is the iOS version of your phone?

hybridapp20161 commented 7 years ago

Yes i am running on actual device with ios version 10.0.2(14A456)and that error comes in error callback alert of startListening() method.

pbakondy commented 7 years ago

I could not found any solution yet. I don't know what this error code means. The Apple docs does not list this error.

This forum topic is about the same issue without resolve: https://forums.developer.apple.com/thread/51938

Please try reinstall cordova and Xcode.

hybridapp20161 commented 7 years ago

We tried reinstalling as well but did not work.

pbakondy commented 7 years ago

Please try with latest XCode 8.1 and iOS 10.1

hybridapp20161 commented 7 years ago

Have updated to ios version:10.1 (14B72) and xcode version:Version 8.1 (8B62) still same issue persist.

LUCIANOSOLER commented 7 years ago

I have same problem, someone have a solution?

Functions Avaliable - works HasPermition - works RequestPermition - works

But startListening - not work

I am with:

Cordova CLI: 6.5.0 Ionic Framework Version: 2.0.1 Ionic CLI Version: 2.1.18 Ionic App Lib Version: 2.1.9 Ionic App Scripts Version: 1.0.0 ios-deploy version: 1.9.1 ios-sim version: 5.0.13 OS: macOS Sierra Node Version: v6.9.2 Xcode version: Xcode 8.2.1 Build version 8C1002

I need help.

LUCIANOSOLER commented 7 years ago

you can send me your project that works on your computer to iOS?

I can test here...

pbakondy commented 7 years ago

Please check last release

ozexpert commented 7 years ago

@pbakondy does the latest release solve the problem? I have the same problem on the device itself. everything is using the latest version (device, itunes, xcode)

pbakondy commented 7 years ago

Yes it does

cperezvinsite commented 7 years ago

I have the versión cordova-plugin-speechrecognition 1.1.2 "Speech Recognition" and I have this problem

cordova 7.0.0
Iphone 6s IOS 10.3.1
Ipad pro IOS 10.0.2
Xcode Version 8.3.2 (8E2002)

I start seeing the problem when I call te startListening method very often like I push the button 3 times in a short period of time ...

"Error Domain=kAFAssistantErrorDomain Code=209 \"(null)\""
cperezvinsite commented 7 years ago

I solved the problem i describe above, the problem is caused because I call the method startListening before the last called returns, so, I used a flag to prevent to call startListening if the last call didn't returned yet. However there still a problem, when I call multiple times the startListening the plugin returns

"Error Domain=kAFAssistantErrorDomain Code=203 \"Corrupt\" UserInfo={NSLocalizedDescription=Corrupt, NSUnderlyingError=0x1704506e0 {Error Domain=SiriSpeechErrorDomain Code=102 \"(null)\"}}"

This error doesn't cause a plugin crash like the previous one, after this error occur the plugin is able to listen again

Mikaelle333777 commented 7 years ago

code=216 -> in my case it was because I initialized the SFSpeechRecognizer without locale. So, the code that worked is:

private SFSpeechRecognizer SpeechRecognizer = new SFSpeechRecognizer(new NSLocale("en_US"));