简体   繁体   中英

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. No matter what I do, I get:

Unable to load nib file: MainMenu, exiting

Steps to reproduce:

  1. create a new project
  2. initialize Package.swift

     swift package init 
  3. Generate SPM file structure

     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. So far, nothing has worked.

Your issue is because your are creating a project with Xcode in step #1.

It conflicts with the files that will be created by the Swift Package Manager (SPM).

You should just cd in a folder then do swift package init then swift package generate-xcodeproj .

This last part will generate the right project files compatible with 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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