문제

I have a signal sigabrt error message with my app in spite every inch of my code is commentary.

I had suddenly this error with no relation with my work. The only way to remove it is to delete every control of my view. Then, when I add new control, the same error appear !

Thanks for your help.

Here is the error message : "* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key defaut.' * First throw call stack: (0... ...1ff5) libc++abi.dylib: terminate called throwing an exception (lldb) "

CalViewController.m

#import "CalViewController.h"



@implementation CalViewController
//@synthesize resultat;
//@synthesize saisieDistance;
//@synthesize saisieTemps;
//@synthesize saisiePoids;
//@synthesize saisieTaille;
//@synthesize defaut;

////@synthesize poidsParDefaut;
////@synthesize tailleParDefaut;
//
//
//double temps;
//double distance;
//double poids;
//double taille;
//double vitesse;
//double tailleDefaut = 180;
//double poidsDefaut=75;
//
//- (void)viewDidLoad
//{
//    [super viewDidLoad];
//  // Do any additional setup after loading the view, typically from a nib.
//}
//
//- (void)didReceiveMemoryWarning
//{
//    [super didReceiveMemoryWarning];
//    // Dispose of any resources that can be recreated.
//}
//
//
//- (IBAction)defautAction:(id)sender {
//    if (defaut.on) {
//        saisieTaille.hidden=YES;
//        saisiePoids.hidden=YES;
//        //tailleParDefaut.hidden=NO;
//        //poidsParDefaut.hidden=NO;
//    }
//    else {
//        saisieTaille.hidden=NO;
//        saisiePoids.hidden=NO;
//        //tailleParDefaut.hidden=YES;
//        //poidsParDefaut.hidden=YES;
//}
//
//}
//
//- (IBAction)tailleAction:(id)sender {
//    taille = [[saisieTaille text] doubleValue];
//    
//}
//
//- (IBAction)poidsAction:(id)sender {
//    poids = [[saisiePoids text] doubleValue];
//}
//
//- (IBAction)tempsAction:(id)sender {
//    temps = [[saisieTemps text] doubleValue];
//}
//
//- (IBAction)distanceAction:(id)sender {
//    distance = [[saisieDistance text] doubleValue];
//}
//
//- (IBAction)calcul:(id)sender {
//    if (defaut.on)
//        vitesse=temps+distance+poidsDefaut+tailleDefaut;
//    else
//        vitesse=temps+distance+poids+taille;
//    resultat.text = [NSString stringWithFormat:@"%f", vitesse];
//}
//
//- (IBAction)saisieReturn:(id)sender;
//{
//    [sender resignFirstResponder];
//}


@end

CalViewController.h

//{
//    double distance;
//    double temps;
//    double vitesse;
//}
//
//
////@property (weak, nonatomic) IBOutlet UILabel *tailleParDefaut;
////@property (weak, nonatomic) IBOutlet UILabel *poidsParDefaut;
//
//@property (weak, nonatomic) IBOutlet UITextView *resultat;
//@property (weak, nonatomic) IBOutlet UITextField *saisieDistance;
//@property (weak, nonatomic) IBOutlet UITextField *saisieTemps;
//@property (weak, nonatomic) IBOutlet UITextField *saisieTaille;
//@property (weak, nonatomic) IBOutlet UITextField *saisiePoids;
//@property (weak, nonatomic) IBOutlet UISwitch *defaut;
//
//
//- (IBAction)distanceAction:(id)sender;
//- (IBAction)tempsAction:(id)sender;
//- (IBAction)tailleAction:(id)sender;
//- (IBAction)poidsAction:(id)sender;
//- (IBAction)calcul:(id)sender;
//- (IBAction)saisieReturn :(id)sender;
//- (IBAction)defautAction:(id)sender;

@end
도움이 되었습니까?

해결책

It's because you have a user interface object that is currently set up in Interface Builder that does not have an associated reference point in code. When the XIB loads, Cocoa attempts to make "IBOutlet connections" with all of the subviews. It does this via Key-Value. What it looks like happened is that you previously set up some IBOutlets within Interface Builder, and by commenting out all code you've eliminated the outlets and thus iOS cannot establish connections.

The solution is to open your xib, eliminate all IBOutlet connections in Interface Builder, uncomment your IBOutlet properties, and reconnect the outlets again.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top