Error: SDK “iphonesimulator9.0” Cannot be located

2020-07-09 09:52发布

问题:

I recently updated Xcode to 7.1 And downloaded iOS 8.4 And iOS 9.0 Simulator.

When I run

xcodebuild -showsdks

I get

OS X SDKs:  OS X 10.11                      -sdk macosx10.11

iOS SDKs:   iOS 9.1                         -sdk iphoneos9.1

iOS Simulator SDKs:     Simulator - iOS 9.1             -sdk
iphonesimulator9.1

tvOS SDKs:  tvOS 9.0                        -sdk appletvos9.0

tvOS Simulator SDKs:    Simulator - tvOS 9.0            -sdk
appletvsimulator9.0

watchOS SDKs:   watchOS 2.0                     -sdk watchos2.0

watchOS Simulator SDKs:     Simulator - watchOS 2.0         -sdk
watchsimulator2.0

I want

iOS Simulator SDKs:

to point to the

iOS 9.0 Simulator or 8.4 Simulator

instead of

Simulator - iOS 9.1 -sdk iphonesimulator9.1

I've tried

xcodebuild -sdk iphonesimulator9.0

But I get

xcodebuild: error: SDK "iphonesimulator9.0" cannot be located.

回答1:

Legacy iOS Simulator SDKs no longer ship with the latest versions of Xcode. To install an older Simulator SDK, take the iPhoneSimulator.sdk directory from an older version of Xcode (Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/‌​iPhoneSimulator.sdk), and copy it to your newer version.

For example, Xcode 6.4 comes with the 8.4 iOS Simulator SDK. To install that in Xcode 7, take the directory:

Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk

Rename it from iPhoneSimulator.sdk to iPhoneSimulator8.4.sdk.

Copy it to your Xcode 7 Simulator SDK directory:

Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs

Observe your new Simulator SDKs: