编写支持iOS 3.1.3和iOS 4.x的iOS应用程序时的陷阱 [英] Pitfalls when writing an iOS app supporting iOS 3.1.3 and iOS 4.x

查看:157
本文介绍了编写支持iOS 3.1.3和iOS 4.x的iOS应用程序时的陷阱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个可以在iOS 3.1.3到iOS 4.1上运行的应用程序。我知道如何设置部署目标和基本SDK。

I would like to write an app which can be run on iOS 3.1.3 up to iOS 4.1. I know how to set up the deployment target and the base SDK.

在阅读Apple文档之后,它严重依赖于检查类是否可用和/或是否为实例回应特定的选择器。

After reading the Apple docs it heavily relies on checking if the class is available and/or if an instance responds to a specific selector.

现在我的问题:


  1. 如果发生了什么?苹果公司从3.1.3到4.x公开上课?当只检查类名时,它也可以在iOS 3.1.3上使用吗?所以在这个版本上我将使用私有API,我不想要。你会怎么检查?这真的是一个问题还是我担心太多了?

  2. 您是否也会使用由iOS版本定义的预处理程序符号?

  3. 其中架构我应该选择armv6还是armv7?我认为armv6也在armv7上运行,这是正确的吗?

  4. 如果我在我的代码中使用iOS 3.1.3中没有的东西,我会从编译器获得任何帮助吗?它会被检查吗?

  5. 我应该知道哪些突出的陷阱?

  1. What happens if Apple made a class public from 3.1.3 to 4.x ? When just checking for the class name it would be available on iOS 3.1.3, too? So on this version I would be using a private API, which I do not want. How would you check that? Is this really a problem or am I worrying too much?
  2. Would you also use preprocessor symbols, which are defined by the iOS version?
  3. Which architecture should I choose armv6 or armv7? I think armv6 runs on armv7 as well, is that correct?
  4. Do I get any help from the compiler if I am using something in my code that is not available in iOS 3.1.3? Does it get checked?
  5. Are there any prominent pitfalls I should know about?

I已经看过WWDC10会议130面向未来的应用程序,所以事情已经知道了。

I already watched session 130 of WWDC10 "Future-proofing your app" so the things said there are known.

谢谢。

推荐答案

根据个人经验,可能没有正确答案,但我会尝试:

Based on personal experience, may not have all the right answers, but I'll try:


  1. 我不认为这是一个问题,因为私有API禁令背后的原因。 Apple禁止使用私有API(至少部分),因为他们不希望在未来版本的iOS中在幕后更改内容,因为它现在是公共API,它可以保证得到支持。

  1. I don't think this is a problem because of the reasoning behind the private API ban. Apple prohibits private APIs (at least in part) because they do not want things to change behind the scenes in future versions of iOS, since it is now public API, it is guaranteed to be supported.

毫无头绪。我已经看到它们用于可以在OSX和iOS上运行的代码。但我不认为我会这样,因为在运行时检测到iOS版本并且编译实际上只能考虑OS X与iOS ,而不是3.x与4.x。

No clue. I've seen them used for code that can run on OSX and iOS.But I don't think I would because iOS version is detected at run time and compiling can really only account for OS X vs iOS, not 3.x vs 4.x.

使用armv6,以便您可以支持较旧的iOS设备。 armv7不会有问题。我相信你是对的,armv7可以运行为armv6构建的应用程序,但我不确定。

Go with armv6 so you can support older iOS devices. It will not be a problem with armv7. I believe that you are right that armv7 can run apps built for armv6, but I am not sure.

这取决于你的目标部署平台即可。如果您调用已弃用的代码,则会收到警告。

It depends on your target deployment platform. You do get warnings if you call deprecated code.

可能。我遇到过iAd的问题,但我不记得具体细节。只需检查现有的类,并记得在必要时进行弱连接和类实例化。

Probably. I've had issues with iAd, but I don't remember specifics. Just check for existing classes and remember to do your weak-linking and class-instantiation where necessary.

这篇关于编写支持iOS 3.1.3和iOS 4.x的iOS应用程序时的陷阱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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