如何使 iPhone 应用程序兼容多个 SDK(固件)版本

发布于 2024-09-05 13:01:58 字数 107 浏览 1 评论 0原文

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

With iOS 4 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 those variables and the .xib file based on the user's firmware?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

念三年u 2024-09-12 13:01:58

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

  • 将您的部署目标设置为您希望能够运行的最早版本,即:3.0。
  • 您将 Base SDK 设置为正在编译的最新版本,即:5.0。这样您就可以在代码中引用较新的定义和符号。本文“SDK 和部署目标” 详细讨论部署与基础 SDK。
  • 与仅在较新的 iOS 中可用的符号的库/框架的链接较弱。这样您的应用程序就可以在没有较新符号的设备上运行。
  • 您必须 在调用之前检查是否有更新的方法可用。您必须确保仅当您的应用程序位于 << 时才调用 5.0 或 4.X 的方法。 4.0设备。当然,您必须通过使用旧方法或不支持需要新 SDK 支持的特定功能来优雅地处理旧版本的工作。
  • 使用 XCode 4.2 的新功能:要支持旧设备,您需要将 armv6 添加到构建架构并且从所需设备功能的plist中删除armv7

有关更多详细信息,请参阅这些 SO 问题和答案:

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

  • 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.

See these SO questions and answers for more details:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文