简体   繁体   English

如何将Xcode指向旧的SDK,以便可以用作“基本SDK”?

[英]How to point Xcode to an old SDK so it can be used as a “Base SDK”?

My Mac's Setup: 我的Mac的设置:

Volume A : 第A卷
OS X 10.8 OS X 10.8
Xcode 4.5 or later - 10.6 SDK IS NOT available as Base SDK Xcode 4.5或更高版本-10.6 SDK 作为基本SDK提供

Volume B : 第B卷
OS X 10.7 OS X 10.7
Xcode 4.3.3 - 10.6 SDK IS available as Base SDK Xcode的4.3.3 - 10.6 SDK 作为基地SDK

Volume C : C卷
OS X 10.6 OS X 10.6
Xcode 4.2 - 10.6 SDK IS available as Base SDK Xcode的4.2 - 10.6 SDK 作为基地SDK


On Volume A, I have installed Xcode 4.5, which does not include the 10.6 SDK as an available "Base SDK" in my Build Targets' Build Settings. 在卷A上,我安装了Xcode 4.5,它在构建目标的构建设置中不包含10.6 SDK作为可用的“基本SDK”。

I have a separate 10.6 volume and 10.7 volume on this hard drive - both of which have Xcode installed, and both of which allow me to select the 10.6 SDK as a Base SDK in my Xcode Build Targets' Build Settings. 我在此硬盘驱动器上有一个单独的10.6卷和10.7卷-两者都已安装Xcode,并且两个都允许我在Xcode Build Targets的Build Settings中选择10.6 SDK作为基本SDK。

I know that I have the 10.6 SDK installed on Volume C (at /Developer/SDKs from an older Xcode installation). 我知道我已经在卷C上安装了10.6 SDK(在较旧的Xcode安装中为/Developer/SDKs )。

How can I point Xcode on Volume A to the 10.6 SDK which lives on Volume C? 如何将第A卷上的Xcode指向第C卷上的10.6 SDK?

You'll need to add a symlink to the old SDK (this is generally easier than copying). 您需要向旧的SDK添加符号链接(通常比复制更容易)。

cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
ln -s /path/to/old/SDK .

This works fine back to 10.5. 这可以正常工作回10.5。 Beyond that things get a little more complicated... 除此之外,事情变得更加复杂...

While there's no promise in future versions of Xcode that this will be supported, I've chatted with the Xcode team about it and they don't seem keen on changing it anytime soon. 尽管在Xcode的未来版本中没有承诺会支持此功能,但我已经与Xcode团队进行了交谈,他们似乎并不希望很快改变它。

Personally I often keep /path/to/old/SDK in a top-level directory called /SDKs. 就我个人而言,我经常将/ path / to / old / SDK保留在名为/ SDKs的顶级目录中。 That way every time I upgrade it's easy to fix everything up. 这样,每次升级时,都可以轻松修复所有问题。

EDIT: I have a fix-xcode script that simplifies re-applying this fix every time Xcode upgrades. 编辑:我有一个fix-xcode脚本,简化了每次Xcode升级时重新应用此修复程序的过程。


UPDATE: In modern versions of Xcode (7.3+) to use older SDKs edit MinimumSDKVersion here: 更新:在现代版本的Xcode(7.3+)中,要使用较旧的SDK, MinimumSDKVersion在此处编辑MinimumSDKVersion

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist

Wrong approach. 错误的方法。 You don't "point" Xcode at an SDK. 您无需将Xcode指向SDK。 Instead you will have better luck copying the SDK into the appropriate "SDKs" folder for the Xcode installation. 取而代之的是,将SDK复制到适当的“ SDKs”文件夹中以进行Xcode安装会更好。 In modern Xcode installations this is usually: 在现代Xcode安装中,这通常是:

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

Copy the SDK in there, quit and restart Xcode and see what you find. 将SDK复制到其中,退出并重新启动Xcode,然后查看发现的内容。

(reading the other answer here I think that symbolic linking might be an option if you are dead-set on keeping the original SDK elsewhere) (在这里阅读其他答案,我认为如果您对将原始SDK保留在其他位置一无所知,则可以选择符号链接)

Why not just symbolic link the SDK's? 为什么不只是符号链接SDK? "ln -s"? “ ln -s”? If that doesn't work there's going to be some plist hacking required. 如果这不起作用,将需要进行一些plist骇客。

通过浏览到较早版本的Xcode.App/Developer/platforms并将iOS 6.1 SDK复制到XCode 5的同一文件夹中来解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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