Swift does not support the SDK 'iPhoneSimulator8.4.sdk'

北城余情 提交于 2020-01-03 08:27:49

问题


Just updated to Xcode 7.0.1, running on El Capitan (GM) with SIP disabled. And now every time I try to compile a Swift project I get this error;

<unknown>:0: error: Swift does not support the SDK 'iPhoneSimulator8.4.sdk'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

I've tried compiling for actual devices as well and get:

<unknown>:0: error: Swift does not support the SDK 'iPhoneOS8.4.sdk'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

My deployment target was originally set to 8.0, I've tried setting it to 9.0 but that makes no difference. My Base SDK is set to Latest iOS(iOS 9.0).

This is across all my Swift projects, even when I create a new project, I still get this error.

It doesn't seem to be affecting Objective-C. One thought I've had, is could this be an issue with SIP being disabled? It doesn't look like a permissions error but I can see no other reason why this isn't working.


回答1:


This happened to me when I had simultaneously installed both Xcode 7 and 6.4 and after automatic update I was left with 7.0.1 only.

One indication that something got messed up was output of xcodebuild -sdk -version:

xcodebuild[29131:8243992] [MT] DVTSDK: Warning: SDK path collision for path '<DVTFilePath:0x7fac2ae3c800:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk'>': SDK with name 'iphoneos9.0' being superceded by SDK with 'iphoneos9.0'.
...
iPhoneOS8.4.sdk - iOS 9.0 (iphoneos9.0)
SDKVersion: 9.0
Path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk
PlatformVersion: 9.0
PlatformPath: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
ProductBuildVersion: 13A340
ProductCopyright: 1983-2015 Apple Inc.
ProductName: iPhone OS
ProductVersion: 9.0
...

There might be easier way to solve this, but reinstalling Xcode 7.0.1 fixed it for me.




回答2:


If you don't want to re-install Xcode (assumption: you're building for iOS 9), just quit Xcode and go to "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/" and remove the "iPhoneOS8.4.sdk" folder from that directory. Be sure to make an external copy if you still need it so you can put it back later. Then restart Xcode, clean, and build. Worked for me.



来源:https://stackoverflow.com/questions/32934067/swift-does-not-support-the-sdk-iphonesimulator8-4-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!