构建一个向后兼容的OS X应用程序,当一个新的API存在? [英] Building a backwards compatible OS X app, when a new API is present?

查看:74
本文介绍了构建一个向后兼容的OS X应用程序,当一个新的API存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要升级应用程式( Clarke )以提供10.6的相容性。

I'm trying to upgrade an app (Clarke) to provide 10.6 compatibility.

我的计划是使用两种不同的代码路径,具体取决于所使用的OSX版本。

My plan is to use two different code paths depending on the version of OSX in use.

在10.5它将使用一个控制器,它由完全自定义的代码组成,不依赖于任何特定的Cocoa API。在10.6它将使用另一个控制器,它基于相同的抽象类将新的CoreLocation API包装在同一个接口中。在运行时,应用程序将通过检测操作系统版本在控制器之间切换。

On 10.5 it will use one controller, which consists of completely custom code that isn't dependent on any specific Cocoa API. On 10.6 it will use another controller, which wraps the new CoreLocation API in an identical interface, based on the same abstract class. At runtime the app will switch between the controllers by detecting the OS version.

这适用于10.6版本的10.6版本,但同样的构建爆炸上10.5 :

This works fine on 10.6 built for the 10.6 SDK, but the same build blows up on 10.5 with:

10/09/2009 18:30:50 [0x0-0x12f12f].uk.co.tomtaylor.Clarke[4575] dyld: unknown required load command 0x80000022 
10/09/2009 18:30:51 com.apple.launchd[403] ([0x0-0x12f12f].uk.co.tomtaylor.Clarke[4575]) Exited abnormally: Trace/BPT trap 



如果我为10.5 SDK构建它无法编译CoreLocation的东西, 。

If I build for 10.5 SDK it can't compile the CoreLocation stuff, obviously.

我希望能够为此应用程序提供一个二进制文件。有没有办法从10.5隐藏CoreLocation API?

I'd hoped to be able to provide a single binary for this application. Is there a way to 'hide' the CoreLocation API from 10.5?

推荐答案

你应该能够解决这个问题,构建目标的设置:

You should be able to solve this problem by changing the build settings of your target:


  1. 将Base SDK设置为10.6

  2. 将Deployment SDK设置为10.5

这篇关于构建一个向后兼容的OS X应用程序,当一个新的API存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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