找不到主故事板?

Main storyboard cannot be found?

我是一个新的 IOS 人。 我只是遇到一个情况,我不知道为什么。如果有人能提供一些建议,真的很感激。

我的问题和这个人的问题很相似:

我的控制台信息是:

 * Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: 'Could not find a storyboard named 'Main' in bundle NSBundle (loaded)' 
* First throw call stack: (0x184c2a530 0x195bac0e4 0x189a04484 0x1896c4590 
0x1896c3728 0x1896c1f1c 0x18d0f1604 0x184be2d70 0x184be1e78 0x184be0078 
0x184b0d1f4 0x1894a3020 0x18949e10c 0x10005fd68 0x19622aa08) libc++abi.dylib: 
terminating with uncaught exception of type NSException (lldb)

你给故事板命名了吗,Main?我的建议是创建一个新项目,并将当前项目的 Info.plist 与新项目进行比较。

如果您希望应用打开故事板,应将其添加到以下行:

    Main storyboard file base name

从源代码来看应该是: UIMainStoryboardFile 主要

样本Info.plist:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>en</string>
        <key>CFBundleExecutable</key>
        <string>$(EXECUTABLE_NAME)</string>
        <key>CFBundleIdentifier</key>
        <string>com.bulenapps.$(PRODUCT_NAME:rfc1034identifier)</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>$(PRODUCT_NAME)</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>1.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>1</string>
        <key>LSRequiresIPhoneOS</key>
        <true/>
        <key>UILaunchStoryboardName</key>
        <string>LaunchScreen</string>
        <key>UIMainStoryboardFile</key>
        <string>Main</string>
        <key>UIRequiredDeviceCapabilities</key>
        <array>
            <string>armv7</string>
        </array>
        <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>UISupportedInterfaceOrientations~ipad</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
    </dict>
    </plist>

请在 didFinishLaunch 方法中编辑 appDelegate.m 文件并尝试这个..

_serialManager = [[RscMgr 分配] 初始化];

DetectionViewModel* detectionViewModel = [[DetectionViewModel alloc] initWithSerialManager: _serialManager];

UIStoryboard * aStoryBorad=[UIStoryboard storyboardWithName:@"Main" bundle:nil];

_viewController = aStoryBorad instantiateViewControllerWithIdentifier:@"_viewController"];

谢谢 问候 赫曼