打开情节提要文件时出错

error opening the storyboard files

在我的项目中,我有不同的 Storyboard 文件来支持不同的 iPhone,我的 appDelegate 中有这段代码:

if (window.frame.size.height == 568){
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:kMain5Name bundle:[NSBundle mainBundle]];
    id rootViewController = [storyBoard instantiateInitialViewController];
    [window setRootViewController:rootViewController];
} else if (window.frame.size.height == 480){
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:kMain5Name bundle:[NSBundle mainBundle]];
    id rootViewController = [storyBoard instantiateInitialViewController];
    [window setRootViewController:rootViewController];
} else if (window.frame.size.height == 667){
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:kMain6Name bundle:[NSBundle mainBundle]];
    id rootViewController = [storyBoard instantiateInitialViewController];
    [window setRootViewController:rootViewController];
} else if (window.frame.size.height == 736){
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:kMain6plusName bundle:[NSBundle mainBundle]];
    id rootViewController = [storyBoard instantiateInitialViewController];
    [window setRootViewController:rootViewController];
} 

每次我编译 运行 应用程序崩溃时说它无法在 NSBundle 中找到故事板文件,我将上面的代码注释掉并再次运行。我的代码有问题吗?

这是 UIStoryboard 的摘录 Class 参考

参数 姓名
故事板资源文件的名称 不带文件扩展名。 如果此参数为 nil,此方法将引发异常。

相关部分我加粗了。如果您不是母语人士,则意味着不要将扩展名添加到参数中。但是您在宏中正是这样做的。

在尝试为代码中的任何问题寻找更深奥的原因之前,您真的应该阅读文档。