Search code examples
iosxcodeibactioniboutlet

IB Connections in Xcode crashing


I was working on my iOS app last night when I went to test it and it crashed on startup. I wasn't even working on the nib that is causing the crash. Anyways, here is the error code:

2/29/12 10:32:05.291 AM Safe Flight: *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0xdd496f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Airport1.'
*** First throw call stack:
(0x2873052 0x33add0a 0x2872f11 0x1ae2032 0x1a53f7b 0x1a53eeb 0x1a6ed60 0x136191a 0x2874e1a 0x27de821 0x136046e 0x1362010 0x114214a 0x1142461 0x11417c0 0x1150743 0x11511f8 0x1144aa9 0x37b7fa9 0x28471c5 0x27ac022 0x27aa90a 0x27a9db4 0x27a9ccb 0x11412a7 0x1142a9b 0x3710 0x2f35)

Airport1 is just a label with an IBOutlet correctly connected to it. Also, if I delete the connection the error just is with the next item that has an connection.

Also, my FileOwners class it correctly set to the appropriate viewController.

//  MasterViewController.h

#import <UIKit/UIKit.h>
#import "MobclixAds.h"

@class DataViewController;
@class EditViewController;
@class SearchViewController;



@interface MasterViewController : UIViewController{

    UILabel *Airport1;
    UILabel *Airport2;
    UILabel *Airport3;
    UILabel *Airport4;
    UILabel *Airport5;
    UILabel *Airport6;
    UILabel *Airport7;
    UILabel *Airport8;
    UILabel *Airport9;
    UIButton *Airport1B;
    UIButton *Airport2B;
    UIButton *Airport3B;
    UIButton *Airport4B;
    UIButton *Airport5B;
    UIButton *Airport6B;
    UIButton *Airport7B;
    UIButton *Airport8B;
    UIButton *Airport9B;

    MobclixAdView* adView;
}

@property (strong, nonatomic) DataViewController *dataViewController;
@property (strong, nonatomic) EditViewController *editViewController;
@property (strong, nonatomic) SearchViewController *searchViewController;


@property (nonatomic, retain) IBOutlet UILabel *Airport1;
@property (nonatomic, retain) IBOutlet UILabel *Airport2;
@property (nonatomic, retain) IBOutlet UILabel *Airport3;
@property (nonatomic, retain) IBOutlet UILabel *Airport4;
@property (nonatomic, retain) IBOutlet UILabel *Airport5;
@property (nonatomic, retain) IBOutlet UILabel *Airport6;
@property (nonatomic, retain) IBOutlet UILabel *Airport7;
@property (nonatomic, retain) IBOutlet UILabel *Airport8;
@property (nonatomic, retain) IBOutlet UILabel *Airport9;
@property (nonatomic, retain) IBOutlet UIButton *Airport1B;
@property (nonatomic, retain) IBOutlet UIButton *Airport2B;
@property (nonatomic, retain) IBOutlet UIButton *Airport3B;
@property (nonatomic, retain) IBOutlet UIButton *Airport4B;
@property (nonatomic, retain) IBOutlet UIButton *Airport5B;
@property (nonatomic, retain) IBOutlet UIButton *Airport6B;
@property (nonatomic, retain) IBOutlet UIButton *Airport7B;
@property (nonatomic, retain) IBOutlet UIButton *Airport8B;
@property (nonatomic, retain) IBOutlet UIButton *Airport9B;

@property(nonatomic,retain) IBOutlet MobclixAdView* adView;


@end

and

// MasterViewController.m


#import "MasterViewController.h"

#import "DataViewController.h"
#import "EditViewController.h"
#import "SearchViewController.h"



@implementation MasterViewController

@synthesize dataViewController = _dataViewController;
@synthesize editViewController = _editViewController;
@synthesize searchViewController = _searchViewController;



@synthesize Airport1, Airport2, Airport3, Airport4, Airport5, Airport6, Airport7, Airport8, Airport9;
@synthesize Airport1B, Airport2B, Airport3B, Airport4B, Airport5B, Airport6B, Airport7B, Airport8B, Airport9B;
@synthesize adView;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = @"Safe Flight";
        self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];
    }
    return self;
}

So is my problem with my code? or with Xcode itself?? I have restarted Xcode and the simulator and even did a "clean" build (it sounded like it would help...)

Thanks, Andrew

EDIT This is my AppDelegate and I'm setting the correct xib to the window

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [Mobclix start];
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.

    MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;

}

PROBLEM SOLVED!!!

I can't answer my own question because of some stupid spam filter... and I can post a picture of the problem... but its fixed!

but here is a link to the problem click here


Solution

  • Found the Problem!! I feel kinda stupid now ;) but anyways, here is a screenshot of the problem!

    Devices "Main Interface" had been unintentionally set