iOS 3.x support in Xcode 4(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):
点击您的项目名称,选择您的目标并在构建设置"下
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 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Xcode 4 中的 iOS 3.x 支持


基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01