iOS 7 - Failing to instantiate default view controller

前端 未结 16 2017
一生所求
一生所求 2020-11-28 03:08

I am using Xcode 5 in a newly created app and when I just create it I go for the run button e click on it, then the project gets built but it does not show in the iOS Simula

16条回答
  •  长情又很酷
    2020-11-28 03:39

    Setup the window manually,

    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        if (!application.keyWindow.rootViewController) 
         {
            UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    
            UIViewController *myViewController= [storyboard instantiateViewControllerWithIdentifier:@"myViewController identifier"];
    
             application.keyWindow.rootViewController = myViewController;
         }
    }
    

提交回复
热议问题