方法未在协议中实现(使用 wit.ai SDK)

Method not implemented in protocol (using wit.ai SDK)

我是第一次使用wit.ai iOS SDK,按照官网https://wit.ai/docs/ios/3.1.1/quickstart入门页面的内容一步步来。我收到此错误:

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

我仍然可以 运行 应用程序并且消息显示在我的收件箱(在控制台中)但没有响应被发回并且应用程序崩溃。我收到此错误:

Error when enqueuing buffer from callback

这是我的代码

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

谢谢。

伙计,你收到的崩溃消息告诉你到底出了什么问题。

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

您在执行协议时缺少一个方法 (witDidGraspIntent:entities:body:error:)。您必须在协议中实现所有必需的方法。在这种情况下,缺少的方法是 witDidGraspIntent:entities:body:error:.

你问 "Should I add a new -void ??" 如果你的意思是你应该添加 witDidGraspIntent:entities:body:error: 方法的实现,答案是 YES!

我之前没有使用过wit.ai SDK。如果您不知道如何自己做,您可能想编辑您的问题并向使用过该 SDK 的人寻求帮助以实现该方法。您可能还想在问题标题中添加“(使用 wit.ai SDK)”,以便熟悉该框架的人注意到您的问题。