如何避免XCode框架弱链接问题?
我正在构建一个应用程序,该应用程序利用仅限 Mac OS X 10.6 的技术,但不放弃对 10.5 Leopard 的向后兼容性。
我这样做的方法是将 10.6 SDK 设置为基础 SDK,弱链接所有框架并将部署目标设置为 10.5,如下所述:
这工作正常;在进行仅限 Snow Leopard 的调用之前,我需要检查选择器或类是否确实存在。或者我可以在拨打电话之前检查操作系统版本。
问题是这非常脆弱。如果我只进行一次 10.6 的调用,我就会破坏 Leopard 兼容性。因此,即使使用普通代码的代码完成功能也可能很危险。
我的问题:在进行发布构建之前,有什么方法可以检查 10.5 上未定义哪些调用?某种静态分析,甚至只是一个技巧(设置另一个 SDK 的目标?)就可以了。
显然,我应该在发布任何东西之前在 Leopard 机器上进行测试,但即便如此,我也不可能在每次发布之前都遍历程序的所有路径。
任何建议将不胜感激。
最好的问候,
弗兰克
I'm building an application that takes advantage of Mac OS X 10.6-only technologies, but without giving up backwards compatibility to 10.5 Leopard.
The way I do this is by setting the 10.6 SDK as the base SDK, weak-linking all frameworks and setting the deployment target to 10.5 as described in:
This works fine; before making a call that is Snow Leopard-only I need to check that the selector or indeed the class actually exist. Or I can just check the OS version before making the call.
The problem is that this is incredibly fragile. If I make a single call that is 10.6 only I blow Leopard-compatibility. So using even the normal code code completion feature can be dangerous.
My question: is there any way of checking which calls are not defined on 10.5 before doing a release build? Some kind of static analysis, or even just a trick (a target set the other SDK?) would do.
I obviously should test on a Leopard machine before releasing anything, but even so I can't possibly go through all paths of the program before every release.
Any advice would be appreciated.
Best regards,
Frank
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将目标 SDK 更改为 10.5。然后,编译器将输出
warning:definition for '-snowLeopardOnlyMethod:' not find
消息。You could change the target SDK to 10.5. The compiler will then output
warning: definition for '-snowLeopardOnlyMethod:' not found
messages.