简体   繁体   English

无法加载nib文件:MainMenu,退出

[英]Unable to load nib file: MainMenu, exiting

I can't figure out how to get package management working for Xcode 8, Swift 3 for a macOS Cocoa app. 我无法弄清楚如何使用Xcode 8,Swift 3为macOS Cocoa应用程序运行包管理。 No matter what I do, I get: 不管我做什么,我得到:

Unable to load nib file: MainMenu, exiting 无法加载nib文件:MainMenu,退出

Steps to reproduce: 重现步骤:

  1. create a new project 创建一个新项目
  2. initialize Package.swift 初始化Package.swift

     swift package init 
  3. Generate SPM file structure 生成SPM文件结构

     swift package generate-xcodeproj 
  4. Run

To troubleshoot, I've tried changing the scheme so the executable is the projectname.app, cleaning, building, force quit and reopen Xcode, adding my Developer ID and enabling signing. 要进行故障排除,我尝试更改方案,以便可执行文件是projectname.app,清理,构建,强制退出并重新打开Xcode,添加我的开发者ID并启用签名。 So far, nothing has worked. 到目前为止,没有任何效果。

Your issue is because your are creating a project with Xcode in step #1. 您的问题是因为您正在步骤#1中使用Xcode创建项目。

It conflicts with the files that will be created by the Swift Package Manager (SPM). 它与Swift Package Manager(SPM)创建的文件冲突。

You should just cd in a folder then do swift package init then swift package generate-xcodeproj . 你应该只是在一个文件夹中cd然后执行swift package init然后swift package generate-xcodeproj

This last part will generate the right project files compatible with SPM. 最后一部分将生成与SPM兼容的正确项目文件。

Note that you can use one of the existing templates to create the project files: swift package init --type executable or swift package init --type library , it will create a set of files specific to each usage. 请注意,您可以使用现有模板之一来创建项目文件: swift package init --type executableswift package init --type library ,它将创建一组特定于每个用法的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM