wit-ai / wit-ios

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

interpretString explanation #76

Closed ag closed 7 years ago

ag commented 7 years ago

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

klintan commented 7 years ago

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

hactar commented 7 years ago

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