Xcode 4.5 和 iOS 4.2.1 不兼容 [英] Xcode 4.5 and iOS 4.2.1 incompatibility

查看:30
本文介绍了Xcode 4.5 和 iOS 4.2.1 不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最新版本说明不支持4.2.1及更低版本,现在支持老设备需要使用2个版本的Xcode开发??如果我们要开发 iOS6 并支持 4.2 及更低版本,这将很难支持旧设备.

The latest release notes indicates 4.2.1 and lower will not be supported, we now have to use 2 version of Xcode to develop when supporting older devices?? This is going to be difficult to support older devices if we want to develop iOS6 AND support 4.2 and lower.

我认为 Xcode 4.4 不会支持 iOS6.所以这就是问题所在.开发人员如何轻松支持这些平台?

I don't think Xcode 4.4 will support iOS6. So this is the issue. How would developers easily support these platform without so much hassle?

推荐答案

你可以这样做,但它需要一些小的 Xcode hacking 和一些牺牲.根据您所说的支持 iOS 6",这对您来说可能不够,也可能不够.如果您只是希望您的应用程序在 iOS 6 上运行,那么这应该可行.如果您还需要您的应用包含新的 iOS 6 功能,那么它不会.

You can do this, but it requires some minor Xcode hacking, and some sacrifices. Depending on what you mean by "support iOS 6", this may or may not be sufficient for you. If you just want your app to run on iOS 6, then this should work. If you also need your app to incorporate new iOS 6 features, then it won't.

  (请注意使用多个版本的 Xcode 没有问题的其他人:这个类似的问题的答案是确实允许您使用新的 iOS 6 API 并直接针对 armv7)

    (Note for others who don't have a problem using multiple versions of Xcode: this similar question has answers that do allow you to also use new iOS 6 APIs and directly target armv7s)

在此处查看 chpwn 博客的基本说明(但也请阅读下面的其余部分!)

See basic instructions on chpwn's blog here (but read the rest of this below, too!)

基本上,您可以使用 Xcode 4.5 为 iOS 4 及更高版本进行构建,但随后您将无法利用仅适用于 iOS 6 的新功能.因此,您实际上是为 iOS 4 和 5 构建的,并假设该应用可以在 iOS 6 上正常运行(这应该是正确的,但您需要自己进行测试).

Basically, you can use Xcode 4.5 to build for iOS 4 and above, but then you can't take advantage of the new iOS 6 only features. So, you're really building for iOS 4 and 5, and assuming that the app will run fine on iOS 6 (which should be true, but you'll need to test this yourself).

您需要复制 iOS 5 SDK 文件夹

You'll need to copy the iOS 5 SDK folder

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.*.sdk

来自旧的 Xcode 安装(您需要暂时保留,或重新安装到非标准位置).然后,您将在 Build Settings 中将 Deploy Target 设置为 iOS 4.0(或您想要的任何最低操作系统).您可能需要在文本编辑器中打开 project.pbxproj 文件来手动设置:

from an old Xcode installation (which you'll need to keep around briefly, or reinstall to a non-standard location). You'll then set the Deploy Target in your Build Settings to iOS 4.0 (or whatever minimum OS you want). You may need to open the project.pbxproj file in a text editor to set this manually:

IPHONEOS_DEPLOYMENT_TARGET = 4.0;

您还需要将架构设置为 armv6armv7.您不能直接定位armv7s.但是,这并不意味着您的应用程序不会在 iPhone 5 上运行.armv7 可执行文件应该在 iPhone 5 上运行,只需在 armv7s 中添加任何优化即可.只是兼容性在另一个方向上不起作用(例如,armv7 可执行文件不能在 armv6 iPhone 3G 上运行).

You'll also need to set the Architectures to armv6 and armv7. You cannot directly also target armv7s. But, that doesn't mean your app won't run on iPhone 5. armv7 executables should run on iPhone 5, simply without any optimizations added in armv7s. It's just that compatibility doesn't work in the other direction (e.g. armv7 executables don't run on an armv6 iPhone 3G).

还有一个可能是必要的步骤,chpwn 的博客中未提及.您可能会收到这些警告(这确实是错误,因为 Xcode 不会正确生成您的可执行文件):

There's also a step that might be necessary, that's not mentioned in chpwn's blog. You may get these warnings (which really are errors, because Xcode won't generate your executable properly):

警告:没有规则来处理架构 armv6 的 sourcecode.c.objc 类型的文件 '$(PROJECT_DIR)/main.m'

warning: no rule to process file '$(PROJECT_DIR)/main.m' of type sourcecode.c.objc for architecture armv6

为了解决这个问题,您需要为您的目标设置一个自定义构建规则,告诉 Xcode 使用 LLVM GCC 4.2 来生成 armv6 代码.为匹配模式 *.[mc] 的文件定义规则:

In order to fix this, you'll need to setup a custom Build Rule for your target that tells Xcode to use LLVM GCC 4.2 to generate armv6 code. Define the rule for files matching the pattern *.[mc]:

这将是一个不同于 Xcode 默认的编译器,您可能需要调整 Objective-C 代码中的一些语法.尽管许多想要这样做的人可能在 ARC 之前编写了他们的应用程序,但重要的是要注意 LLVM gcc 4.2 不支持 ARC.

This will be a different compiler than the Xcode default, and you may need to adjust some of the syntax in your Objective-C code. Even though many people wanting to do this probably wrote their apps before ARC, it is important to note that LLVM gcc 4.2 does not support ARC.

最后,您可能仍会看到来自 Xcode 的警告,关于 iOS 部署目标低于 4.3,并且不支持 armv6.我发现这些都不是问题,可以忽略:

Finally, you probably will still see warnings from Xcode about iOS deploy targets less than 4.3, and armv6 not being supported. Those, I found, were not problems, and could be ignored:

在我的应用程序可执行文件上运行 lipo -info 显示所需的结果:

Running lipo -info on my app executable after this shows the desired result:

lipo -info MyAppName
Architectures in the fat file: MyAppName are: armv6 armv7 

这篇关于Xcode 4.5 和 iOS 4.2.1 不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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