wit-ai/wit-ios

interpretString explanation

ag opened this issue · 2 comments

ag commented

Can someone please explain how the interpretString method works? @hactar @blandinw @dsposito

I used it like this:
Implemented this in my viewcontroller which has a "Process"-button and a text view which is used below as "answerTextView.text"

- (IBAction)queryText:(id)sender{
    [[Wit sharedInstance] interpretString:answerTextView.text customData:nil];
}

When this is run, the result is available in the delegate method which is implement like so:

-(void)witDidGraspIntent:(NSArray *)outcomes messageId:(NSString *)messageId customData:(id)customData error:(NSError *)e{
    NSLog(@"%@", outcomes);
    NSLog(@"%@", customData);
    NSLog(@"%@", messageId);
    NSLog(@"%@", e);
}

In outcomes you will have an NSArray containing the response from Wit.ai.
This all assumes you followed the quickstart/setup in the Readme file. Hopes this helps :)

Closing as the question was answered. Please reopen if you are having issues.