删除Main.storyboard后iOS应用程序崩溃

时间:2016-04-16 21:25:37

标签: ios objective-c iphone cocoa-touch storyboard

我想切换到xib,所以我删除了Main.storyboard。现在,当调用didFinishLaunchingWithOptions时,应用程序在[self.window makeKeyAndVisible]中没有输出日志而崩溃。我已经清除了目标中的主界面 - 常规 - 部署信息。崩溃是否与删除Main.storyboard时应删除的某些链接有关?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {   
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    MainViewController *mvc = [[MainViewController alloc] init];
    UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:mvc];

    self.window.rootViewController = nvc;
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    return [[AWSMobileClient sharedInstance] didFinishLaunching:application withOptions:launchOptions];
}

0x10759e180上的断点:

UIKit`-[UIWindow makeKeyAndVisible]:
    0x10759e156 <+0>:  pushq  %rbp
    0x10759e157 <+1>:  movq   %rsp, %rbp
    0x10759e15a <+4>:  pushq  %rbx
    0x10759e15b <+5>:  pushq  %rax
    0x10759e15c <+6>:  movq   %rdi, %rbx
    0x10759e15f <+9>:  movq   0xc62182(%rip), %rsi      ; "isHidden"
    0x10759e166 <+16>: callq  *0xce6074(%rip)           ; (void *)0x0000000108f97800: objc_msgSend
    0x10759e16c <+22>: testb  %al, %al
    0x10759e16e <+24>: je     0x10759e182               ; <+44>
    0x10759e170 <+26>: movq   0xc63a11(%rip), %rsi      ; "_orderFrontWithoutMakingKey"
    0x10759e177 <+33>: movq   %rbx, %rdi
    0x10759e17a <+36>: callq  *0xce6060(%rip)           ; (void *)0x0000000108f97800: objc_msgSend
    0x10759e180 <+42>: jmp    0x10759e194               ; <+62>
    0x10759e182 <+44>: movq   0xc66a2f(%rip), %rsi      ; "_updateLayerOrderingAndSetLayerHidden:"
    0x10759e189 <+51>: xorl   %edx, %edx
    0x10759e18b <+53>: movq   %rbx, %rdi
    0x10759e18e <+56>: callq  *0xce604c(%rip)           ; (void *)0x0000000108f97800: objc_msgSend
    0x10759e194 <+62>: cmpq   %rbx, 0xce0045(%rip)      ; _UIKeyWindow
    0x10759e19b <+69>: je     0x10759e1b3               ; <+93>
    0x10759e19d <+71>: movq   0xc66bfc(%rip), %rsi      ; "makeKeyWindow"
    0x10759e1a4 <+78>: movq   %rbx, %rdi
    0x10759e1a7 <+81>: addq   $0x8, %rsp
    0x10759e1ab <+85>: popq   %rbx
    0x10759e1ac <+86>: popq   %rbp
    0x10759e1ad <+87>: jmpq   *0xce602d(%rip)           ; (void *)0x0000000108f97800: objc_msgSend
    0x10759e1b3 <+93>: addq   $0x8, %rsp
    0x10759e1b7 <+97>: popq   %rbx
    0x10759e1b8 <+98>: popq   %rbp
    0x10759e1b9 <+99>: retq   

1 个答案:

答案 0 :(得分:1)

我终于发现我新添加的xib缺少从View到ViewController的链接。在文件的所有者 - 连接检查器 - 插座我将视图插座拖到xib的视图,然后问题解决了。