wz366
wz366

Reputation: 2930

iOS app crashes after deleting Main.storyboard

I wanted to switch to xib so I deleted Main.storyboard. Now the app crashed with no output log in didFinishLaunchingWithOptions when [self.window makeKeyAndVisible] is called. I have already cleared Main Interface in Target - General - Deployment Info. Is the crash related to some links that should be removed when I deleted the 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];
}

Breakpoint on 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   

Upvotes: 0

Views: 445

Answers (1)

wz366
wz366

Reputation: 2930

I finally found out that my newly added xib is missing a link from View to the the ViewController. In File's Owner - Connections Inspector - Outlets I dragged view outlet to the xib's view and then problem is solved.

Upvotes: 1

Related Questions