【问题标题】:Main storyboard cannot be found?找不到主情节提要?
【发布时间】:2015-04-06 03:52:16
【问题描述】:

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

我的问题和这个人的问题很相似: IOS-Convert code-based interface to Storyboard based interface

我的控制台信息是:

 * 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)

【问题讨论】:

  • 我已经将情节提要名称添加到 plist 中,但它仍然不起作用。仍然给我线程 1:信号 SIGABRT 错误

标签: ios iphone user-interface


【解决方案1】:

你给故事板起名字了吗,梅恩?我的建议是创建一个新项目,并将当前项目的 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>

【讨论】:

  • 谢谢大佬,已经找到解决办法了!~反正是坦克!我刚刚在 Storyboard Membership 中检查了目标
【解决方案2】:

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

_serialManager = [[RscMgr alloc] init];

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

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

_viewController = aStoryBorad instantiateViewControllerWithIdentifier:@"_viewController"];

谢谢 问候 赫曼特

【讨论】:

  • 谢谢!!!问题已解决,我只是在他的目标成员中检查了 storyboard 的目标
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-04-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多