문제

So I am making a card playing game where I have a UITabBarController and I have two tabs. Now the first tab is working perfectly fine but when I click on the other tab I receive this error "Thread 1: signal SIGABRT" and on the debugger panel I have "argc = (int 1)" and argv = (char **) 0xbffff38c. I am using a story board for this project.

Below is my View Controller for the tab that throws me the error above. If you need anymore code let me know but I was thinking it was probably a problem with my View since it won't even load.

#import "GameResultsViewController.h"
#import "GameResult.h"

@interface GameResultsViewController ()
@property (weak, nonatomic) IBOutlet UITextView *textResults;

@end

@implementation GameResultsViewController


- (void) updateUI
{
    NSString* displayText = @"";

    for (GameResult* gameResult in [GameResult allGameResults])
    {
        displayText = [displayText stringByAppendingFormat:@"Score: %d %@ %0g\n",gameResult.score, gameResult.end, round(gameResult.duration)];
    }
    self.textResults.text = displayText;
}
- (void) setup
{

}
- (void) awakeFromNib
{
    [self setup];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    [self setup];
    return self;
}
- (void) viewWillAppear:(BOOL)animated
{

    [super viewWillAppear:animated];
    [self updateUI];
}

@end

this was also in the debugger window

    2013-07-25 20:38:46.360 Matchismo[1119:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<GameResultsViewController 0x758cce0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key display.'
*** First throw call stack:
(0x1c9b012 0x10d8e7e 0x1d23fb1 0xb84e41 0xb065f8 0xb060e7 0xb30b58 0x23a019 0x10ec663 0x1c9645a 0x238b1c 0xfd7e7 0xfddc8 0xfdff8 0xfe232 0x11f8c9 0x11f704 0x11dbda 0x11da5c 0x11f647 0x10ec705 0x202c0 0x20258 0x242ff4 0x10ec705 0x202c0 0x20258 0xe1021 0xe157f 0xe1056 0x246af9 0x10ec705 0x202c0 0x20258 0xe1021 0xe157f 0xe06e8 0x4fcef 0x4ff02 0x2dd4a 0x1f698 0x1bf6df9 0x1bf6ad0 0x1c10bf5 0x1c10962 0x1c41bb6 0x1c40f44 0x1c40e1b 0x1bf57e3 0x1bf5668 0x1cffc 0x297d 0x28a5)
libc++abi.dylib: terminate called throwing an exception
(lldb) 
도움이 되었습니까?

해결책

This part of your console log tells you what's going on:

[<GameResultsViewController 0x758cce0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key display.'

*** First throw call stack:

At some point in your app, an object is trying to set the 'display' property on an object of the GameResultsViewController class - but that class does not have this property.

It might be a stray outlet in Interface Builder if you've renamed a property - the old connection still exists in Interface Builder, so when the NIB loads the runtime tries to connect the outlet and fails with this error. Or you have a line of code somewhere where you have something like gameResultsViewController.display = ... and the display property is incorrect (either incorrectly named, or you haven't added to the GameResultsViewController class yet).

My 5c is on a renamed property being left in Interface Builder. Check out the outlet view on your ViewController to see if there's anything grayed out - usually indicates a broken property. Example here I renamed the button property to myButton - so you see the unconnected myButton property, and the warning on the button property.

BrokenOutlets

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