0

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
GoldXApp
  • 2,397
  • 3
  • 17
  • 26
  • http://stackoverflow.com/questions/3088059/this-class-is-not-key-value-coding-compliant-for-the-key ...plenty of possible solutions for you there – Chris Tetreault Jul 08 '13 at 18:00

1 Answers1

1

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.

Daddy
  • 9,045
  • 7
  • 69
  • 98
  • OK, thanks for your help. I don't know anything about XIB, how can I open my file in XIB ? – GoldXApp Jul 08 '13 at 18:23
  • It's probably called MainStoryboard.storyboard in your project. – danh Jul 08 '13 at 20:24
  • I've created a new project with the same properties but today error. I created, deleted and recreate every connexions but everytime, there is this error. How can I edit my XIB ? – GoldXApp Jul 09 '13 at 20:02
  • When the interface is loaded in memory, a connection inside the xib/storyboard is telling the operating system to try to find a UIControl with the name "defaut". Using key value coding, the operating system sends the message [view setValue:CONTROLOBJECT forKey:@"defaut"], but there is no connection available with that key and a crash occurs. It's impossible to troubleshoot without manually inspecting your project. Generally, errors like this occur when you change the name of a control in code but don't update it in the interface inspector, or you changed the name of your viewController class – Daddy Jul 10 '13 at 18:55