Mac SDK:使用最新的 SDK,但确保向后兼容早期的部署目标 [英] Mac SDK: using latest SDK but ensuring backwards compatibility with earlier deployment target

查看:28
本文介绍了Mac SDK:使用最新的 SDK,但确保向后兼容早期的部署目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一如既往,当 Apple 更新 OS X 时,最新的 XCode 4.4 转储了旧的 (10.6) SDK,我发现自己需要使用 10.7 SDK(或者我想是 10.8)并将我的部署目标设置为 10.6 以保持兼容性.

As always when Apple updates OS X, the latest XCode 4.4 dumps the older (10.6) SDK and I find myself needing to use the 10.7 SDK (or 10.8 I suppose) and setting my deployment target to 10.6 to maintain compatibility.

我更喜欢链接到较旧的 SDK,因为我知道我不能错误地引入对尚不存在的 API 的调用.上次尝试逆向方法时,我发现自己经常做的事情.

I prefer linking to the older SDK because I know that I cannot by mistake introduce calls to APIs that do not yet exist. Something that I found myself doing regularly when I last tried the inverse approach.

我发现自己在做的是,我使用 XCode 中的代码完成功能为像 NSWorkspace 这样的简单类选择正确"调用,然后在开发过程中一切正常,我忘记了它,当我发布新版本时: 卡布姆!整个应用程序在运行时在早期的 OS X 版本上爆炸;经常在那些难以到达的地方:-)

What I find myself doing is that I use the code completion feature in XCode to choose the "right" call for a simple class like NSWorkspace, then everything works fine during development, I forget about it and when I release a new version: Kaboum! The whole application explodes on earlier OS X releases at run-time; often in those hard-to-reach places :-)

或者至少几年前我的情况是这样.

Or at least this was the situation for me a few years back.

当然,现在有一种方法可以:

Surely, by now there's a way to either:

  • 确保不引入部署目标中尚不可用的 API 调用,即使它们已在 SDK 中定义

  • making sure you don't introduce API calls that are not yet available in your deployment target even if though they are defined in the SDK

在构建或静态分析期间检测此类调用

detecting such calls during build or static analysis time

我确定我错过了一些东西,沿线某处..请赐教!

I'm sure I've missed something, somewhere along the line.. Please enlighten me!

最好的问候,

弗兰克

推荐答案

当然,现在有一种方法可以:

Surely, by now there's a way to either:

  • 确保不引入尚不可用的 API 调用在您的部署目标中,即使它们是在 SDK 中定义的

  • making sure you don't introduce API calls that are not yet available in your deployment target even if though they are defined in the SDK

在构建或静态分析期间检测此类调用

detecting such calls during build or static analysis time

不,没有.是的,您应该针对它打开一个雷达 (bugreport.apple.com).如果你愿意,你可以欺骗我的:rdar://11985733

No there is not. Yes, you should open a radar (bugreport.apple.com) against it. If you like, you can dupe mine: rdar://11985733

是的,尽管 Apple 建议,唯一可行的解​​决方案是复制旧的 SDK 并链接它们.

Yes, the only viable solution, despite Apple's recommendation, is to copy the old SDKs and link against them.

我在 WWDC 2012 上花了很长时间与 Xcode 团队讨论这个问题.他们一致认为它已经坏了.目前没有修复它的计划.不断升级的雷达是我们在这些事情上影响 Apple 的方式.

I spent quite some time talking with the Xcode team about exactly this issue at WWDC 2012. They agreed that it's broken. There is not currently a plan to fix it. Escalating radar's is how we influence Apple on these things.

这篇关于Mac SDK:使用最新的 SDK,但确保向后兼容早期的部署目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆