Error in backup buffer from callback Wit.ai SDK for iOS

I am new to iOS and I am writing my first application using the wit.ai SDK (following this guide https://wit.ai/docs/ios/3.1.1/quickstart ).

I can run my application and send a command (which I will find in my wit.ai mailbox), but then the application is frantic.

Here is my code:

Appdelegate.h

#import <UIKit/UIKit.h> 
@interface AppDelegate : UIResponder <UIApplicationDelegate> 
@property (strong, nonatomic) UIWindow *window;
@end

AppDelegate.m

#import "AppDelegate.h"
#import <Wit/Wit.h>

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Wit sharedInstance].accessToken = @"ASW7RE57SOSZLTNBAM6HQ53QAWXSROOI";
[Wit sharedInstance].detectSpeechStop = WITVadConfigDetectSpeechStop;
// Override point for customization after application launch.
return YES;
}

ViewController.h

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

@interface ViewController : UIViewController <WitDelegate>


@end

ViewController.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController {
    UILabel *labelView;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // set the WitDelegate object
    [Wit sharedInstance].delegate = self;

    // create the button
    CGRect screen = [UIScreen mainScreen].bounds;
    CGFloat w = 100;
    CGRect rect = CGRectMake(screen.size.width/2 - w/2, 60, w, 100);

    WITMicButton* witButton = [[WITMicButton alloc] initWithFrame:rect];
    [self.view addSubview:witButton];

    // create the label
    labelView = [[UILabel alloc] initWithFrame:CGRectMake(0, 200, screen.size.width, 50)];
    labelView.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:labelView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)witDidGraspIntent:(NSArray *)outcomes entities:(NSDictionary *)entities body:(NSString *)body error:(NSError*)e {
    if (e) {
        NSLog(@"[Wit] error: %@", [e localizedDescription]);
        return;
    }
    NSDictionary *firstOutcome = [outcomes objectAtIndex:0];
    NSString *intent = [firstOutcome objectForKey:@"intent"];

    labelView.text = [NSString stringWithFormat:@"intent = %@", intent];

    [self.view addSubview:labelView];
}

@end

Here are the errors I get:

2015-01-12 22: 24: 21.419 FirstApp [11199: 775307] WITVad init 2015-01-12 22: 24: 27.789 FirstApp [11199: 775513] : -66632 2015-01-12 22: 24: 27.790 FirstApp [11199: 775513] : -66632 2015-01-12 22: 24: 27.790 FirstApp [11199: 775513] : -66632 2015-01-12 22: 24: 27.790 FirstApp [11199: 775513] : -66632 2015-01-12 22: 24: 27.790 FirstApp [11199: 775513] : -66632 2015-01-12 22: 24: 36.442 FirstApp [11199: 775307] - [ NSCFString objectAtIndex:]: , 0x7f8da0c60c30 2015-01-12 22: 24: 36.755 FirstApp [11199: 775307] *** - "NSInvalidArgumentException", : '- [__ NSCFString objectAtIndex:]: , 0x7f8da0c60c30' *** : (   0 CoreFoundation 0x0000000105bd0f35 __exceptionPreprocess + 165   1 libobjc.A.dylib 0x000000010548fbb7 objc_exception_throw + 45   2 CoreFoundation 0x0000000105bd804d - [NSObject (NSObject) doesNotRecognizeSelector:] + 205   3 CoreFoundation 0x0000000105b3027c ___ _ + 988   4 CoreFoundation 0x0000000105b2fe18 _CF_forwarding_prep_0 + 120   5 FirstApp 0x00000001034778bd - [ViewController witDidGraspIntent: : : :] + 253   6 FirstApp 0x000000010347a705 - [Wit processMessage:] + 535   7 FirstApp 0x000000010347a3a2 - [Wit gotResponse: error:] + 67   8 FirstApp 0x000000010347a3f3 - [Wit gotResponse: : customData:] + 62   9 FirstApp 0x0000000103478549 - [WITRecordingSession gotResponse: error:] + 196   10 FirstApp 0x000000010347b726 39- [WITUploader startRequestWithContext:] _ block_invoke + 708   11 CFNetwork 0x0000000106781935 __67 + [NSURLConnection sendAsynchronousRequest: queue: completeHandler:] _ block_invoke_2 + 155   12 Foundation 0x000000010360201f __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 7   13 Foundation 0x0000000103541db2 - [NSBlockOperation main] + 98   14 Foundation 0x0000000103524384 - [ NSOperationInternal _start:] + 645   15 0x0000000103523f93 __NSOQSchedule_f + 184   16 libdispatch.dylib 0x0000000106eec7f4 _dispatch_client_callout + 8   17 libdispatch.dylib 0x0000000106ed58fb _dispatch_main_queue_callback_4CF + 949   18 CoreFoundation 0x0000000105b38fe9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9   19 CoreFoundation 0x0000000105afbeeb __CFRunLoopRun + 2043   20 CoreFoundation 0x0000000105afb486 CFRunLoopRunSpecific + 470   21 0x0000000107f739f0 GSEventRunModal + 161   22 UIKit 0x00000001039d2420 UIApplicationMain + 1282   23 FirstApp 0x0000000103477e53 main + 115   24 libdyld.dylib 0x0000000106f21145 start + 1   25??? 0x0000000000000001 0x0 + 1 ) lib++ abi.dylib: NSException

.

+4

All Articles