Ios Xcode崩溃中的IB连接

Ios Xcode崩溃中的IB连接,ios,xcode,ibaction,iboutlet,Ios,Xcode,Ibaction,Iboutlet,昨晚我正在开发我的iOS应用程序,当时我去测试它,它在启动时崩溃了。我甚至没有在造成撞车的笔尖上工作。无论如何,下面是错误代码: 2/29/12 10:32:05.291 AM Safe Flight: *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0xdd496f0> setValue:forUndefinedKey:]: this cl

昨晚我正在开发我的iOS应用程序,当时我去测试它,它在启动时崩溃了。我甚至没有在造成撞车的笔尖上工作。无论如何,下面是错误代码:

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)
我的代码有问题吗?或者使用Xcode本身??我重新启动了Xcode和模拟器,甚至做了一个“干净”的构建(听起来好像会有帮助…)

谢谢, 安德鲁

编辑这是我的AppDelegate,我正在为窗口设置正确的xib

- (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;

}
问题解决了

我不能回答我自己的问题,因为一些愚蠢的垃圾邮件过滤器。。。我可以贴一张问题的照片。。。但它是固定的


但是这里有一个问题的链接

当您初始化MasterViewController(无论从何处启动它)时,请确保使用适当的nib文件初始化它


导致崩溃的原因可能是xib到标头的连接错误。 Airport1可以连接到MasterViewController以外的其他类

如果您的标签连接到文件的所有者,则标签应为MasterViewController

如果您在xib中创建了另一个UIViewController并将Airport1标签连接到它,则此控制器也应连接到MasterViewController标识检查器”字段。)

更新。新增截图:


找到了问题!!我现在觉得有点傻;)但无论如何,这里有一个问题的截图


查找视图控制器所在的xib。用与FileOwner相同的方法更改类。我不明白你想说什么,请你澄清一下好吗?你看到生成错误的对象不是ViewController,而是UIApplication吗?你能把代码贴在调用它的地方吗?我想让你做的和给出的答案是一样的。我建议您不要在FileOwner上查找Identity Inspector类,而是在视图控制器本身中查找。您是在任何xib中声明它,还是直接在代码中创建它?您的视图控制器是在任何主xib文件中声明的,在该文件上有UIWindow吗?如果是,您还必须更改它的类名。navigationController是ivar吗?它有到xib的出口吗?这很奇怪,我以前有过这个问题,所以我检查了它,然后将类设置为我的viewController。一定是别的原因,我猜不出你的问题。这只是最常见的错误。如果您再次检查您的xib连接器-我相信-您会找到原因。我的类设置正确:/I我希望它是如此简单伟大。然后检查所有者属性中是否没有黄色三角形(鼠标右键)。如果标签连接正确。如果是-我没有其他想法,对不起。您的xib设置如何?它是否只有一个设置了“文件所有者”视图出口的“UIView”对象。或者您是否向xib添加了UIViewController。?如果是后者,请确保该文件具有适当的类(MasterViewController)。
// 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;
}
- (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;

}
MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"YourNibName" bundle:nil];