线程 1 信号 SIGABRT 无法加载 Main.Storyboard

Thread 1 signal SIGABRT can't load Main.Storyboard

我不知道我做了什么,但我搞砸了我的应用程序,现在它在加载之前就崩溃了,我收到了这个错误:

*** Terminating app due to uncaught exception 
'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 
'NSBundle </Users/MasonSatnick/Library/Developer/CoreSimulator/Devices/9F0F56D8-AA2C-459F-84A3-BB17F5982716/data/Containers/Bundle/Application/A84FCDB3-1F61-486F-A108-863858F7AD76/Dodge The Box.app> 
(loaded)' with name 'Main''

我该如何解决这个问题?

要事第一。退出 Xcode 但离开模拟器 运行。告诉模拟器重置。然后把Derived Data文件夹里的东西全部清空扔掉。

现在启动 Xcode,看看问题是否奇迹般地得到解决。

如果没有,请检查您的 Info.plist。它应该有一个 "Main storyboard file base name" 条目,其值为 "Main"。如果它已转化为其他条目(例如主 nib 文件),请修复它。

由于无法看到您的项目,我打算尝试一些可能是问题的解决方案。

  1. 确保在 Target > General 中选择了正确的故事板文件

  2. 确保您的 Main.storyboard 已检查您正在使用的目标。在我的例子中是 "The Rap App"

  1. 如果这些都不是问题,请右键单击 Main.Storyboard 并单击“在查找器中显示”,确保您的查找没有移动。如果是这种情况,Main.Storyboard 很可能是红色的。

  2. 按住 Shift + Option + Command + K,然后按 "Clean"。然后退出 Xcode 并重新打开。

如果它仍然给你关于这个答案的问题评论和新信息,我会尝试进一步帮助。

编辑: 以下是重新创建 Info.Plist 文件的步骤。

  1. 删除当前的 .plist 文件。

  2. 键入 Command + N > iOS > 资源 > 属性 列表

  3. 非常重要给文件命名 "Info" 如果你不这样做将无法工作。

  4. 右键单击您的新 info.plist > 打开为... > 源代码。

  5. 突出显示所有内容并粘贴到下面的代码中(注意:对于更多读者,请将 "mason" 更改为您的公司标识符)

    <?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.mason.Dodge-The-Box</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>
    
  6. 右键单击您的 info.plist 文件 > 查看为... > 属性 列表。

  7. 转到目标 > 构建设置 > 搜索 "info.plist file"

  8. 确保值为"My App Name/Info.plist"

  9. Shift + Command + option + K > 按"clean"

  10. 构建和 运行!

我将我的设置为:

但我不得不将其设置为:

通常您需要 select 的值在下拉列表中。你只需要 select 它。