如何使iPhone App与多个SDK(固件)版本兼容 [英] How To Make iPhone App compatible with multiple SDK (firmware) versions

查看:126
本文介绍了如何使iPhone App与多个SDK(固件)版本兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着iOS4即将推出,我已经计划在未来的应用更新中加入iAd。我认为这将使我的应用程序无法用于固件低于4.0的任何人。有没有办法根据用户的固件更改变量和.xib文件?
干杯。

With iOS4 coming out soon, I have already planned to include an iAd in a future update of an app of mine. I assume that this will make my app unusable for anyone on a firmware lower than 4.0. Is there a way to change that variables and the .xib file based on the user's firmware? Cheers.

推荐答案

是的,您可以使用最新的SDK(即:5.1)构建并仍在设备上运行使用早期版本的固件(SDK)。

Yes, you can build with the latest SDK (ie: 5.1) and still run on devices with earlier versions of the firmware (SDK).


  • 将部署目标设置为您希望能够运行的最早版本,即:3.0。

  • 您将Base SDK设置为您正在编译的最新版本,即:5.0。这样,您可以在代码中引用较新的定义和符号。本文SDK和部署目标详细讨论部署与基础SDK。

  • 指向仅在较新的iOS中可用的符号的库/框架的弱链接。这样您的应用就会在没有新符号的设备上运行。

  • 您必须在调用之前检查是否有更新的方法 。只有当您的应用程序位于<时,您才必须确保不要调用5.0或4.X的方法。 4.0设备。当然,您必须通过使用旧方法或不支持需要更新SDK支持的特定功能来优雅地处理旧版本。

  • NEW w / XCode 4.2:要支持旧设备,您需要将armv6 添加到构建体系结构 从所需设备功能的plist中删除armv7

  • Set your Deployment Target to the earliest version you want to be able to run with, ie: 3.0.
  • You set your Base SDK to the latest version that you are compiling with, ie: 5.0. This way you can reference the newer definitions and symbols in your code. This article "SDK and Deployment Targets" discusses Deployment vs Base SDK in detail.
  • Weak link to the libraries/frameworks with symbols that are only available in the newer iOS. This is so your app will run on a device that doesn't have the newer symbols.
  • You must check to see that a newer method is available before calling it. You have to make sure not to call a method that is 5.0 or 4.X only when your app is on a < 4.0 device. Of course you have to gracefully handle working on older versions by either using older methods or not supporting particular features that need newer SDK support.
  • NEW w/XCode 4.2: To support older devices you need to add armv6 to the build architectures and remove armv7 from the plist of required device capabilities.

有关详细信息,请参阅以下SO问题和解答:

See these SO questions and answers for more details:

  • deployment target vs base/active sdk
  • recommended way to support backward compatibility
  • How do you optionally use iPhone 3.0 features in a 2.0 compatible app
  • iPhone dev weak link framework
  • weak linking with IB
  • universal iphone/ipad app compilation error
  • iphone apps should include armv6

这篇关于如何使iPhone App与多个SDK(固件)版本兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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