3

I'm using the wit.ai iOS SDK for the first time and I followed step by step what is written in the getting started page in official website https://wit.ai/docs/ios/3.1.1/quickstart. I got this error:

Method 'witDidGraspIntent:entities:body:error:' in protocol 'WitDelegate' not implemented.

I could still run the app and the message is shown in my inbox (in console) but not response is being sent back and the application crashes. I got this error:

Error when enqueuing buffer from callback

Here is my code

ViewController.m

#import "ViewController.h"
@interface ViewController ()

@end

@implementation ViewController {
    UILabel *labelView;
}

- (void)witDidGraspIntent:(NSArray *)outcomes 
                messageId:(NSString *)messageId 
               customData:(id)customData 
                    error:(NSError*)e {
    //Implementation here...
    labelView.text = @"Hey what's up";
    [self.view addSubview:labelView];
}

ViewController.h

#import <UIKit/UIKit.h>
#import <Wit/Wit.h>

@interface ViewController : UIViewController <WitDelegate>


@end

Thanks.

halfer
  • 19,824
  • 17
  • 99
  • 186
laribiwalid
  • 148
  • 9
  • You have only implemented `witDidGraspIntent:messageId:customData:error:`. You need to (also?) implement `witDidGraspIntent:entities:body:error:`. – Ian MacDonald Jan 12 '15 at 20:48
  • Should I add a new -void ?? Why this is not listed in the Getting started guide in website ?? Thanks. – laribiwalid Jan 12 '15 at 20:58
  • You should implement all of the methods required by the protocol. Please contact the writer of the getting started guide directly if you have further questions. – Ian MacDonald Jan 12 '15 at 21:01
  • I already did. And posted this question here in case there are people who had the same problem and can help. Thanks – laribiwalid Jan 12 '15 at 21:03

1 Answers1

3

Dude, the crash message you are getting is telling you exactly what is wrong.

Method 'witDidGraspIntent:entities:body:error:' in protocol 'WitDelegate' not implemented.

You are missing a method (witDidGraspIntent:entities:body:error:) in your implementation of the protocol. You must implement all the required methods in a protocol. In this case the missing method is witDidGraspIntent:entities:body:error:.

You ask "Should I add a new -void ??" By that, if you mean should you add an implementation of the witDidGraspIntent:entities:body:error: method, the answer is YES!

I haven't used the wit.ai SDK before. You might want to edit your question and ask people who have used that SDK for help in implementing the method if you can't figure out how to do it on your own. You might also want to add "(using wit.ai SDK)" to your question title so people familiar with that framework notice your question.

Duncan C
  • 128,072
  • 22
  • 173
  • 272