我已经尝试了 2 天来让我的故事板显示以下代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *LoginViewController = [storyboard instantiateInitialViewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = LoginViewController;
[self.window makeKeyAndVisible];
return YES;
}
但是,我的主目录中不断出现此错误和 sigbart:'NSInvalidArgumentException',原因:'在捆绑包 NSBundle(已加载)中找不到名为'MainStoryboard' 的故事板'
谷歌似乎没有出现关于这些错误的信息?有谁知道如何解决它?
更新:当我将其更改为:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
UIViewController *LoginViewController = [storyboard instantiateInitialViewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = LoginViewController;
[self.window makeKeyAndVisible];
return YES;
}
它给了我错误:[3208:c07] 如果要使用主情节提要文件,应用程序委托必须实现窗口属性。
{AppDelegate setWindow:]:无法识别的选择器发送到实例 0x962bf30
[3208:c07] *由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[AppDelegate setWindow:]:无法识别的选择器发送到实例 0x962bf30”