wit-ai / wit-ios

Wit.ai iOS client
Other
222 stars 71 forks source link

unrecognized selector error #26

Closed bluekite2000 closed 10 years ago

bluekite2000 commented 10 years ago

I have my own button instead of wit button. when line 1 is executed the program crashes.

}

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'

lasryaric commented 10 years ago

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

bluekite2000 commented 10 years ago

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?

ar7hur commented 10 years ago

Are you using wit/location or your own location entity?

ar7hur commented 10 years ago

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.

ar7hur commented 10 years ago

Here is the doc about Roles https://wit.ai/docs/console/complete-guide#roles

bluekite2000 commented 10 years ago

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

bluekite2000 commented 10 years ago

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

l5t commented 10 years ago

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

lasryaric commented 10 years ago

@bluekite2000 I will investigate both issues with the selector, fix them and release a new version.

bluekite2000 commented 10 years ago

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?

l5t commented 10 years ago

Good catch, it is usually under 2-3 secondes. We have seeing some performance issue today. We are on it.

lasryaric commented 10 years ago

@bluekite2000 I just released a new version of the SDK 0279cffa873eb551204af4d4f47780aa0342985a which is fixing the selector crash. I'm closing this issue.

Thanks for reporting it!