ios 带有旧版基础 SDK 的 Xcode 8

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37838406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 09:23:53  来源:igfitidea点击:

Xcode 8 with older Base SDK

iosxcode8

提问by tonik12

I'm running into compatibility issues for some external frameworks I'm using in my project. Is there a way to change the Base SDK on Xcode 8? Currently in the project settings only show me the Latest SDK.

我在项目中使用的某些外部框架遇到了兼容性问题。有没有办法在 Xcode 8 上更改 Base SDK?目前在项目设置中只显示最新的 SDK。

I've tried copying the older SDK from another version of Xcode to here but it didn't work:

我曾尝试将旧版 SDK 从另一个版本的 Xcode 复制到此处,但没有奏效:

/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

回答by Jerry Krinock

Starting with Xcode 7.3, in addition to copying in the SDK, you must also edit a certain Info.plist file, as described here for macOS in the post by agx. It looks like there is a similar file for iOS, at

从 Xcode 7.3 开始,除了在 SDK 中复制之外,您还必须编辑某个 Info.plist 文件,如 agx 的帖子中针对 macOS 的此处所述。看起来 iOS 有一个类似的文件,位于

Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Info.plist

Try changing the value of MinimumSDKVersionin there from 10.0 to whatever SDK version you want.

尝试将其中的MinimumSDKVersion的值从 10.0更改为您想要的任何 SDK 版本。

I've not tried this with iOS, but, using this workaround, I was just able to build a macOS target with macOS 10.6 using Xcode 8.0 (8A218a) (the "GM").

我没有在 iOS 上尝试过这个,但是,使用这个解决方法,我只能使用 Xcode 8.0 (8A218a)(“GM”)在 macOS 10.6 上构建一个 macOS 目标。

UPDATE

更新

The hack described above stopped working for me in Xcode 9. If you want to use Xcode 9+, see my more recent answer dated Nov 22, 2017.

上面描述的 hack 在 Xcode 9 中对我不起作用。 如果您想使用 Xcode 9+,请参阅我于 2017 年 11 月 22 日发布的最新答案。

回答by Jerry Krinock

My original answer, although it worked with Xcode 8, for some strange reason which is not worth explaining, no longer works with Xcode 9 on a particular client's old project. So I've been using an alternative workflow which is really not too bad.

我原来的答案,虽然它与 Xcode 8 一起工作,但出于一些不值得解释的奇怪原因,不再在特定客户的旧项目上与 Xcode 9 一起工作。所以我一直在使用另一种工作流程,这真的还不错。

To work on this project, I open it in boththe older Xcode, which can build it with the required SDK, and in a recent Xcode. I put the old Xcode window in the background and do my work in the recent Xcode. When I am ready to test changes, I do a File> Save All(??S), then switch to the old Xcode and Build(?B). When the build is done, I switch back to the recent Xcode and Product> Perform Action> Run without Building(??R). Because the dSYM file format has not changed, breakpoints work as expected.

在这个项目上工作,我在打开这两个上了年纪的Xcode,它可以与所需的SDK构建它,并在最近的Xcode。我将旧的 Xcode 窗口放在后台,并在最近的 Xcode 中完成我的工作。当我准备好测试更改时,我执行File> Save All( ??S),然后切换到旧的 Xcode 和Build( ?B)。构建完成后,我切换回最近的 Xcode 和Product> Perform Action> Run without Building( ??R)。因为 dSYM 文件格式没有改变,断点按预期工作。

The advantages are that no hacking of Xcode is required, and the only thing I need to remember about the old Xcode (Xcode 3 in my case) is, mercifully: ?B.

优点是不需要对 Xcode 进行黑客攻击,而且我唯一需要记住的关于旧 Xcode(在我的情况下为 Xcode 3)是,幸运的是:?B

One little warning: In this particular project's Target, in Build Settings, it has a custom Build Products Path. This is typical of the way Mac apps were built years ago. To ensure that both of your Xcodes are working with the same product, if your old and recent Xcodes straddle the version which changed the default Build Products Path, you may need to set Build Products Path.

一个小小的警告:在这个特定项目的 Target 中,在Build Settings 中,它有一个自定义的Build Products Path。这是多年前构建 Mac 应用程序的典型方式。为确保您的两个 Xcode 都使用相同的产品,如果您的旧的和最近的 Xcode 跨越更改默认Build Products Path的版本,您可能需要设置Build Products Path

The workflow could probably be made even easier by scripting the xcodebuildand xcode-selectcommand line tools, but this is good enough. With Apple's announcement at this year's WWDC about support for 32-bit Mac apps going away during the next two years, my client has some tough decisions ahead in any case.

通过编写脚本xcodebuildxcode-select命令行工具,工作流程可能会变得更加简单,但这已经足够了。随着 Apple 在今年的 WWDC 上宣布将在未来两年内停止支持 32 位 Mac 应用程序,我的客户在任何情况下都面临着一些艰难的决定。

回答by asdf

You just have to change the "Deployment Target" settings. You basically use the latest available SDK as base SDK but select a target OS X version. Of course it depends on why you want to use an older SDK?

您只需要更改“部署目标”设置。您基本上使用最新的可用 SDK 作为基础 SDK,但选择目标 OS X 版本。当然这取决于您为什么要使用较旧的SDK?