unrecognized selector error
bluekite2000 opened this issue · 12 comments
I have my own button instead of wit button. when line 1 is executed the program crashes.
-
(void) micTapped:(id)sender {
[[Wit sharedInstance] toggleCaptureVoiceIntent: self]; //line 1
}
The complete error is
WITVad init
[HelloWorldLayer sessionDidStart:]: unrecognized selector sent to instance 0x15f509270
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HelloWorldLayer sessionDidStart:]: unrecognized selector sent to instance 0x14f611450'
Hey,
It is because the (id)sender needs to implements the following interface :
// https://github.com/wit-ai/wit-ios-sdk/blob/master/Wit/WITSessionToggle.h
@protocol WITSessionToggle <NSObject>
-(void)sessionDidStart:(WITRecorder *)recorder;
-(void)sessionDidEnd:(WITRecorder *)recorder;
@end
You could not find it because the function declaration does not enforce that. I will fix it for the next release, sorry about that.
These two functions (void)sessionDidStart:(WITRecorder *)recorder;
and -(void)sessionDidEnd:(WITRecorder *)recorder;
are here to let you manage the rendering of your button based on the state of the recording (do some animation etc).
I ended up using wit's button. One question I have a command "take me to the pit" yet wit is unable to determine the location. I keep validating it (5 times already) but still it hasn't learnt. what should I do?
Are you using wit/location
or your own location entity?
wit/location
is trained once per hour across all the dataset (as opposed to your entities, that are trained is near real time after each new example). If one hour has passed and it's not working, it may be because "your" locations are different :) in which case you should add a Role => it will train it specifically for you.
Here is the doc about Roles https://wit.ai/docs/console/complete-guide#roles
The commands are "take me to the kitchen" and "take me to the stairs". As a wit/lcation I am getting "kitchen" and " the stairs". Why the extra "the" ?
And it crashes sometimes
Cannot remove an observer <WITMicButton 0x12e624070> for the key path "power" from <WITRecorder 0x170241920> because it is not registered as an observer
as for the wit/location, as ar7hur said, it is trained across many instances so it is likely that other developers trained with examples including "the" for instance (go to "the dentist", or go to "the safeway on cambridge ave"....) So in your case, I would create a custom entity : https://wit.ai/docs/console/complete-guide#create-custom-entities-link
@bluekite2000 I will investigate both issues with the selector, fix them and release a new version.
Another question is performance. Currently it takes 4-6 secs for the api to return the results. Anything I can do to speed it up?
Good catch, it is usually under 2-3 secondes. We have seeing some performance issue today. We are on it.
@bluekite2000 I just released a new version of the SDK 0279cff which is fixing the selector crash. I'm closing this issue.
Thanks for reporting it!