我该如何确定我的iOS SDK版本?

118

我确定这很简单,但我如何确定当前安装的iOS SDK版本?

7个回答

205
如果您输入以下内容:
$> xcodebuild -showsdks

它会得到像这样的东西:

$> OS X SDKs:
    OS X 10.8                       -sdk macosx10.8
    OS X 10.9                       -sdk macosx10.9

iOS SDKs:
    iOS 6.1                         -sdk iphoneos6.1
    iOS 7.0                         -sdk iphoneos7.0

iOS Simulator SDKs:
    Simulator - iOS 6.0             -sdk iphonesimulator6.0
    Simulator - iOS 6.1             -sdk iphonesimulator6.1
    Simulator - iOS 7.0             -sdk iphonesimulator7.0

1
我应该在xcodebuild中使用-sdk iphoneos还是-sdk iphoneos7.0 - nn0p
对我没用。Jason Medeiros的答案有效! - Doug Null

62
如果您关心构建版本号(例如“10B61”),尤其是在测试版期间,最好的检查Xcode及其相关SDK版本的方法是使用“系统信息”。
苹果菜单>关于本机>系统报告>软件>开发人员。
在那里,您将看到有关开发工具的所有主要组件的版本和构建号。顶级版本和构建号对应于您从Apple下载的磁盘映像的名称。
截至macOS 10.14.3,这就是全部内容。

17
在Mac操作系统10.7 / Lion中,我需要进行以下步骤:点击苹果菜单 > 关于本机 > 更多信息 > 系统报告 > 软件 > 开发人员。 - Stan Kurdziel
我认为这对于新的macOS版本来说有点过时了。 - Randika Vishman

19

对于最新版本的MAC OS Mountain Lion:

苹果菜单>关于本机>更多信息...>系统报告...>软件>开发人员

您将会找到如下开发人员信息:

版本:4.6(4H127) 位置:/Applications/Xcode.app 应用程序: Xcode: 4.6 (2066) Instruments: 4.6 (46000) SDKs: OS X: 10.7: (11E52) 10.8: (12C37) iOS: 6.1: (10B141) iOS模拟器: 6.1: (10B141)


这与Jason的答案结合Stan在下面的评论有何不同?他们早在你回答之前就包含了你提供的信息。 - Arda

16

更新:感谢Stan演示了如何在Lion上使用Xcode 4.3完成此操作:

ls /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/‌​SDKs/
以下命令列出了您计算机上安装的所有iPhone SDK的清单。
ls /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

4
我认为这是由于 Xcode 如何从应用商店安装的方式而发生了变化。我使用的是 10.7 / Lion 系统,必须执行以下操作:ls /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ - Stan Kurdziel

1

从桌面进入:实用工具/系统信息/软件/开发者 -- 列出已安装的SDK


0

我发现最简单的方法是运行这个命令行:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

或者,如果你有多个XCode版本:

sudo xcode-select -switch /Applications/Xcode<version_number>.app/Contents/Developer

fastlane 无法成功执行该命令,因此看起来您没有选择要使用 xcodebuild 运行的 Xcode 版本。运行上面的 xcode-select 命令应该可以解决问题;)

来源:https://github.com/fastlane/fastlane/issues/12784


0
xcode-select --print-path #print your current path Probably this path
/Library/Developer/CommandLineTools

sudo xcode-select --reset #reset to the default command line tools path 


xcode-select --print-path# the default should this path
/Applications/Xcode.app/Contents/Developer


xcrun -sdk iphonesimulator --show-sdk-path #the path: /usr/bin/xcrun 
#should to print the num of iPhoneSimulator:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator{num}.sdk


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接