且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将应用程序更新到 iOS6

更新时间:2023-01-01 17:44:07

由于这是一个关于支持多个 iOS 版本的非常笼统的问题,并且不涵盖任何 iOS6 特定的内容(由 NDA 涵盖),因此我的回答如下:

Since this is a pretty generic question about supporting multiple versions of iOS and does not cover any iOS6 specific things (covered by NDA), here goes my answer:

如果我使用 6.0 的部署目标重新编译和构建应用程序并修复所有已知问题,例如不推荐使用的方法等.当 Apple 发布适用于 iOS6 的 GM 时,任何构建版本是否也可以编译并适用于 iOS5 设备?

if I re-compile and build an app using the deployment target of 6.0 and fix all the known issues e.g. deprecated methods etc. when Apple releases GM for iOS6, will any build compile and work with iOS5 devices as well?

原则上,是的,只要您没有使用任何仅限 iOS6 的功能或者您使用得当(请参阅第三个问题的答案).但是,如果您想确保一切正常运行,几乎必须在运行 iOS5/4(或模拟器)的实际设备上进行测试.

In principle, yes, it will, provided you have not used any iOS6-only feature or you did it properly (see the answer to your third question). However, testing against an actual device running iOS5/4 (or the simulator) is almost mandatory if you want to be sure that things work correctly.

目前在较旧的 iOS 版本下运行的某些东西也有可能在 iOS6 上崩溃(这可能发生在添加了一些错误的情况下,也可能发生在修复了一些错误并且碰巧您的代码有一个自己的错误,抵消了前者的影响).所以,测试为王.(感谢 rsswtmr 对此的评论).

There is also a chance that something that is currently working under an older iOS version will just break on iOS6 (this can happen in case some bugs were added, but also in case some bugs were fixed and it happens that your code had a bug of its own that countered the effect of the former). So, testing is the king. (Thanks to rsswtmr's comment about this).

我应该只提交部署目标为 5.0 的应用,还是无法在 iOS6 中运行?

Should I just be submitting apps with a deployment target of 5.0 or will those fail to run in iOS6?

如果您的应用不使用任何仅适用于 iOS6 的功能(或者您使用得当,请稍后阅读),您可以指定部署目标为 5.0;也就是说,这个设置不会破坏与iOS6的兼容性;

You can specify a deployment target of 5.0 if your app does no use any iOS6-only feature (or you do it properly, read later); in other words, this setting will not break compatibility with iOS6;

如果我使用新的 iOS6 功能,我的部署目标应该只是 iOS6 吗?

Should my deployment target only be iOS6 if I am using new iOS6 features?

可以,但不是唯一的方法.

It can, but it is not the only way.

如果您将部署目标指定为 iOS6,那么您可以在您的应用程序中***使用任何仅适用于 iOS6 的功能而无需担心.应用商店机制会阻止您的应用安装在任何较旧的设备上,这样您就安全了.

If you specify your deployment target as iOS6, then you can freely use any iOS6-only feature in your app without concern. The app store mechanics will prevent your app from being installed on any older device and you will be safe.

另一方面,如果您将部署目标指定为 iOS5 或更低版本,那么您仍然可以在您的应用中使用任何仅 iOS6 的功能,但您应该通过保护"iOS6 的任何使用来正确支持旧版本的 iOS- 仅功能并为 iOS5 提供后备.

On the other hand, if you specify your deployment target as iOS5 or older, then you can still use any iOS6-only feature in your app, but you should properly support older versions of iOS by "guarding" any usage of iOS6-only features and providing a fallback for iOS5.

这意味着:假设您将使用仅在 iOS6 上可用的 featureA;你可以做的是:

This means the following: say that you are going to use featureA only available on iOS6; what you can do is:

  1. 检查该功能是否在运行时可用(例如类respondsToSelector等);

  1. check to see if the feature is available at runtime (e.g. class respondsToSelector, etc);

#ifdef 中保护您的代码,以便仅在可能的情况下才对其进行编译;

guard your code within an #ifdef so that it will be compiled only on when possible;

如果 1. 处的检查失败,请为较旧的 iOS 版本定义出路.

if the check at 1. will fail, define a way out for older iOS versions.

看看这篇关于支持多个iOS的帖子版本.