什么是着手这个布尔正确的方法是什么? [英] What is the correct way to proceed with this bool?

查看:137
本文介绍了什么是着手这个布尔正确的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个布尔在我AppDelegate.m:

I have this bool in my AppDelegate.m:

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

        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

        UIViewController *viewController = // determine the initial view controller here and instantiate it with [storyboard instantiateViewControllerWithIdentifier:<storyboard id>];

        self.window.rootViewController = viewController;
        [self.window makeKeyAndVisible];

        return YES;
    }

我在故事板*得到一个错误,但什么,我主要是试图做的是初始化比主要的一个不同的视图控制器中的应用。我都使用标识(如一个我想推出名为家园)的视图控制器。会如何,如果说我的ViewController ID在家里我正确地写这个布尔?

I'm getting an error on the *storyboard but what I am mainly trying to do is initialize the application in a different view controller than the main one. I have all the view controllers with IDs (such as the one I want to launch is named "Home"). How would I correctly write this bool if say my ViewController ID was home?

我的main.m文件:

My main.m:

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

int main(int argc, char * argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

我得到的是零每当我试图从我的联系人列表页面回到原来的主页,因此崩溃,并突出了零线。无论这和上面的委托布尔是给我的问题。任何澄清会pciated非常AP $ P $,谢谢。

The nil I get is whenever I try to go back to the original Home page from my Contact list page so it crashes and highlights the nil line. Both this and the above delegate bool are giving me issues. Any clarification would be very much appreciated, thanks.

推荐答案

堆栈跟踪解释了什么是错的:

The stack trace explains what's wrong:


      
  • 终止应用程序由于未捕获的异常'NSInvalidArgumentException',原因是:找不到一个故事板
      在包一个NSBundle(加载)*
  • 名为MainStoryboard
      
  • Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'MainStoryboard' in bundle NSBundle (loaded)' *

您的故事板不叫MainStoryboard。

Your storyboard isn't called "MainStoryboard".

这篇关于什么是着手这个布尔正确的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆