Xcode 4 中的 iOS 3.x 支持 [英] iOS 3.x support in Xcode 4

查看:14
本文介绍了Xcode 4 中的 iOS 3.x 支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 Xcode 4 编写支持 iOS 3.x 版本的应用程序?如果是这样,怎么做?Apple 是否对应用程序的向后兼容性有任何官方建议?

Is it possible to write apps that support iOS 3.x versions using Xcode 4? If so, how? And does Apple have any official recommendations on app backwards-compatibility?

推荐答案

要让您的应用在 iOS 3.x 设备上成功运行,请按照以下步骤操作(Xcode 4.2):

To get your app successfully run in iOS 3.x device, follow these steps (Xcode 4.2):

  1. 点击您的项目名称,选择您的目标并在构建设置"下

  1. Click on your project name, select your Target and under "Build Settings"

a) 将iOS 开发目标"(在部署"下)设置为 3.0

a) Set "iOS development target" (under "Deployment") to 3.0

b).将armv6"添加到架构"列表(在架构"下).

b). Add "armv6" to list of "Architectures" (under "Architectures").

c) 将其他链接器标志"(在链接"下)设置为-weak-lSystem".

c) Set "Other Linker Flags" (under "Linking") to "-weak-lSystem".

在您的 Info.plist 文件中,从必需的设备功能"(UIRequiredDeviceCapabilities) 中删除armv7"的值.

In your Info.plist file remove value of "armv7" from "Required device capabilities" (UIRequiredDeviceCapabilities).

在您的代码中:

一).不要使用 userInterfaceIdiom.如果您需要知道它是什么设备(iPhone 或 iPad),请参阅 如何让 UI_USER_INTERFACE_IDIOM() 与 iPhone OS SDK 一起工作 <3.2.

a). Do not use userInterfaceIdiom. If you need to know, what device is it (iPhone or iPad), see How does one get UI_USER_INTERFACE_IDIOM() to work with iPhone OS SDK < 3.2.

b) 不要使用 window.rootViewController.而是使用 [window addSubview: self.mainViewController.view]; 将主控制器的视图添加到窗口.

b) Do not use window.rootViewController. Instead use [window addSubview: self.mainViewController.view]; to add your main controller's view to window.

点击您的项目名称,选择您的目标,然后在Build Phases"/Link Binary With Libraries"下将UIKit.framework"设置为Optional".还可以将任何额外的框架设置为可选,这在 iOS 3 中不可用.例如,如果您使用 iAd 或 Twitter 框架,则应将它们设置为可选.使用前检查代码中额外框架的可用性.

Click on your project name, select your Target and under "Build Phases" / "Link Binary With Libraries" set "UIKit.framework" to "Optional". Also set to optional any extra framework, which is not available in iOS 3. For example, if you're using iAd or Twitter frameworks they should be set to optional. Check availability of extra framework in your code before use.

在真机上运行时,根据最新版本的 SDK 编译应用程序.为此,请从方案"下拉菜单中选择第二项(否则您将收到与可选 SDK 相关的编译错误):

When run on real device, compile app against last version of SDK. To do so, select second item from "Scheme" drop down (otherwise you'll get compile error related to your optional SDKs):

这篇关于Xcode 4 中的 iOS 3.x 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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