Mac SDK:使用最新的SDK,但确保与早期部署目标的向后兼容性 [英] Mac SDK: using latest SDK but ensuring backwards compatibility with earlier deployment target
问题描述
和苹果更新OS X一样,最新的XCode 4.4转储旧的(10.6)SDK,我发现自己需要使用10.7 SDK(或10.8我想),并将我的部署目标设置为10.6以保持兼容性。 / p>
我喜欢链接到旧的SDK,因为我知道我不能错误地引入对尚不存在的API的调用。
我发现自己在做的是使用XCode中的代码完成功能来选择right 调用一个简单的类像NSWorkspace,然后一切工作正常在开发过程中,我忘了它,当我发布一个新的版本:Kaboum!整个应用程序在运行时在早期的OS X版本上爆炸;通常在那些难以到达的地方: - )
或者至少这是我几年前的情况。
当然,现在有一种方法:
-
确保不引入API调用即使它们在SDK中定义
-
在构建或静态分析时检测到此类调用
我相信我错过了一些东西,沿线的某处..请启发我!
最好的问候,
Frank
当然,现在有一种方法:
确保你不介绍即使它们在SDK中定义
在构建或静态分析期间检测到此类调用,您的部署目标中尚未提供
的API调用时间
是的,你应该打开一个雷达(bugreport.apple.com)。如果愿意,您可以复制我的文件: rdar:// 11985733
是的,唯一可行的解决方案,尽管苹果的建议,是复制旧的SDK,并链接到他们。
我花了很多时间与Xcode团队就WWDC 2012上的这个问题,他们同意它的坏。目前没有解决它的计划。升级雷达是我们如何影响苹果对这些事情。
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.
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.
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:
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!
Best regards,
Frank
Surely, by now there's a way to either:
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
No there is not. Yes, you should open a radar (bugreport.apple.com) against it. If you like, you can dupe mine: rdar://11985733
Yes, the only viable solution, despite Apple's recommendation, is to copy the old SDKs and link against them.
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屋!