3

我是第一次使用 wit.ai iOS SDK,我一步一步按照官网https://wit.ai/docs/ios/3.1.1/quickstart的入门页面中的内容进行操作。我收到了这个错误:

协议“WitDelegate”中的方法“witDidGraspIntent:entities:body:error:”未实现。

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

从回调中排队缓冲区时出错

这是我的代码

视图控制器.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];
}

视图控制器.h

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

@interface ViewController : UIViewController <WitDelegate>


@end

谢谢。

4

1 回答 1

3

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

协议“WitDelegate”中的方法“witDidGraspIntent:entities:body:error:”未实现。

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

你问“我应该添加一个新的 -void 吗?” 这样,如果您的意思是应该添加该witDidGraspIntent:entities:body:error:方法的实现,那么答案是肯定的!

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

于 2015-01-12T21:28:35.413 回答