问题
I'm having trouble running swift package generate-xcodeproj
. I created my package like this:
$ /Applications/Xcode9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift package init --type executable
(as I have many Xcode versions installed I explicitly targeted a swift
binary when running the command so that I don't need to xcode-select
all the time)
This created a Package.swift
with the version header // swift-tools-version:4.0
.
Now, when I run swift package generate-xcodeproj
I get a fatal error:
$ /Applications/Xcode9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift package generate-xcodeproj
/Users/max.chuquimia/Desktop/xcode/MyPackage: error: manifest parse error(s):
<unknown>:0: error: Swift does not support the SDK 'MacOSX10.12.sdk'
No .xcodeproj
is generated. Why is this occurring?
回答1:
It seems the problem is the $DEVELOPER_DIR
environment variable is wrong - it should also be made to point to the Xcode version that the swift
binary resides in.
$ DEVELOPER_DIR=/Applications/Xcode9.4.1.app/Contents/Developer /Applications/Xcode9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift package generate-xcodeproj
来源:https://stackoverflow.com/questions/51094495/swift-package-generate-xcodeproj-fails-with-swift-does-not-support-the-sdk