打开ViewController时出错

时间:2014-04-22 17:09:11

标签: ios crash viewcontroller

当我要去TableViewController

时,我收到此错误代码
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<GuestlistViewControler 0xbc458e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key GueslistViewControler.'

然而,它已经在

之前工作了

所以现在当我打开应用程序时,一切正常,没有警告,没有错误。但当我在我的TabBar中进入此页面时,整个应用程序冻结并且我得到上面的错误。

的.m

//
//  GuestlistViewControler.m
//  Club La Boom
//
//  Created by Kevin Archambault on 2014-04-21.
//  Copyright (c) 2014 Club La Boom. All rights reserved.
//

#import "GuestlistViewControler.h"

@implementation GuestlistViewControler

-(IBAction)addData:(id)sender{

    NSString *name = self.NameText.text;
    NSString *invite = self.InviteText.text;
    NSString *email = self.EmailText.text;
    NSString *phone = self.CellText.text;
    NSString *date = self.DateText.text;

    NSString *rawStr = [NSString stringWithFormat:@"name=%@&invite=%@&&email=%@&phone=%@&date=%@", name,
                        invite,
                        email,
                        phone,
                        date];

    NSData *data = [rawStr dataUsingEncoding:NSUTF8StringEncoding];

    NSURL *url = [NSURL URLWithString:@"http://www.clublaboom.com/guestlist_iphone.php"];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

    [request setHTTPMethod:@"POST"];
    [request setHTTPBody:data];
    NSURLResponse *response;
    NSError *err;
    NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];

    NSString *responseString = [NSString stringWithUTF8String:[responseData bytes]];
    NSLog(@"%@", responseString);

    NSString *success = @"success";
    [success dataUsingEncoding:NSUTF8StringEncoding];

    NSLog(@"%lu", (unsigned long)responseString.length);
    NSLog(@"%lu", (unsigned long)success.length);



    [self dismissViewControllerAnimated:YES completion:nil];
    UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Félicitation" message:@"Votre guestlist à été enregistré!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [alertsuccess show];

}



@end

·H

//
//  GuestlistViewControler.h
//  Club La Boom
//
//  Created by Kevin Archambault on 2014-04-21.
//  Copyright (c) 2014 Club La Boom. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreGraphics/CoreGraphics.h>


@interface GuestlistViewControler :
UITableViewController {
    UITextField *_NameText;
    UITextField *_InviteText;
    UITextField *_EmailText;
    UITextField *_CellText;
    UITextField *_DateText;
    UIButton *_SubmitButton;
}
@property (strong, nonatomic) IBOutlet UITableViewController *GuestlistViewControler;

@property (nonatomic, retain) IBOutlet UITextField * NameText;
@property (nonatomic, retain) IBOutlet UITextField * InviteText;
@property (nonatomic, retain) IBOutlet UITextField * EmailText;
@property (nonatomic, retain) IBOutlet UITextField * CellText;
@property (nonatomic, retain) IBOutlet UITextField * DateText;
@property (nonatomic, retain) IBOutlet UIButton * SubmitButton;




@end

1 个答案:

答案 0 :(得分:-1)

在代码的某个地方,你拼错了GuestlistViewControler。在左侧的Xcode中选择搜索按钮:

enter image description here

输入GueslistViewControler并按Enter键。将GueslistViewControler替换为GuestlistViewControler