如何使用 iOS 5 构建 armv6 和 armv7 架构
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7488657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to build for armv6 and armv7 architectures with iOS 5
提问by iGranDav
In iOS5Apple drops the armv6architecture from the ARCHS_STANDARD_32_BIT.
在iOS5 中,Apple从ARCHS_STANDARD_32_BIT 中删除了armv6架构。
In order to keep the support for iPhone3GI still want to compile in armv6even in iOS5.
为了保持对iPhone3G的支持,我还是想在armv6中编译,即使是在 iOS5 中。
Did anyone find a solution for this?
有没有人为此找到解决方案?
采纳答案by Mark Granoff
I just built something today specifying a deployment target of iOS 4.0. With only armv7 specified in Architectures, Xcode warned me that to support anything below iOS4.2 I had to include armv6 in Architectures. Just edit that field, click the "+" button when the dialog pops up and enter the literal "armv6".
我今天刚刚构建了一些东西,指定了 iOS 4.0 的部署目标。由于在 Architectures 中只指定了 armv7,Xcode 警告我要支持 iOS4.2 以下的任何内容,我必须在 Architectures 中包含 armv6。只需编辑该字段,在弹出对话框时单击“+”按钮并输入文字“armv6”。
In my case, we want our app to work under iOS4 and iOS5. We had to make some modifications so it would work correctly under iOS5, but all those changes were done with iOS4-friendly code changes.
就我而言,我们希望我们的应用程序能够在 iOS4 和 iOS5 下运行。我们不得不进行一些修改以使其在 iOS5 下正常工作,但所有这些更改都是通过对 iOS4 友好的代码更改完成的。
We also added some iOS5-specific capabilities in a manner that allows the app to run without crashing under iOS4. Specifically, we tested for iOS5 capabilities before trying to use them, and linked iOS5-only libraries as Optional.
我们还添加了一些特定于 iOS5 的功能,以允许应用程序在 iOS4 下运行而不会崩溃。具体来说,我们在尝试使用 iOS5 功能之前对其进行了测试,并将仅限 iOS5 的库链接为 Optional。
So, supporting iPhone3G in an iOS5 world could just as easily mean "we want our app to run on iOS4 and above (regardless of any iOS5 feature use)" rather than "we want to make sure our app runs on an older device running iOS5". There's a difference here; think about it. :-)
因此,在 iOS5 世界中支持 iPhone3G 可能意味着“我们希望我们的应用程序在 iOS4 及更高版本上运行(无论使用任何 iOS5 功能)”,而不是“我们希望确保我们的应用程序在运行 iOS5 的旧设备上运行”。这里有区别;想想看。:-)
Anyway, adding armv6 support back in is very easy. And I guess the point is this: At some point, when there are no more armv6 devices out there to worry about (for whatever reason) you won't have to build for it. Apple's view is everyone should upgrade to the latest hardware as soon as possible. So in that world, there is no need for the tools to default to anything but the latest and greatest too. :-) Fortunately (or not), we developers live in the real world and recognize that you have to support older stuff for a while. And I guess the Xcode dev team knows this too, which is why you can add armv6 support back in quite simply.
无论如何,重新添加 armv6 支持非常容易。我想重点是这样的:在某个时候,当没有更多的 armv6 设备需要担心(无论出于何种原因)时,您就不必为其构建。苹果的观点是每个人都应该尽快升级到最新的硬件。因此,在那个世界中,工具不需要默认为最新和最好的。:-) 幸运的是(或不是),我们的开发人员生活在现实世界中,并且认识到您必须暂时支持旧的东西。而且我猜 Xcode 开发团队也知道这一点,这就是为什么您可以非常简单地重新添加 armv6 支持的原因。
回答by adjwilli
The simple answer is that you have to change the current settings from "Standard (armv7) - $(ARCHS_STANDARD_32_BIT)" to just be "armv6" and "armv7". See the image below. You have to delete the line with the previous settings for it to work.
简单的答案是您必须将当前设置从“标准 (armv7) - $(ARCHS_STANDARD_32_BIT)”更改为“armv6”和“armv7”。见下图。您必须删除具有先前设置的行才能使其工作。
回答by ubert
also make sure you set this in Project AND Targets ... cost me an hour to figure that out. had set it for one but not the other. hope this helps. GLTA
还要确保你在项目和目标中设置了这个......花了我一个小时来弄清楚这一点。已将其设置为一个而不是另一个。希望这可以帮助。GLTA
回答by jfieres
I think there's a reason why Apple dropped armv6 from the standard setting.
我认为 Apple 从标准设置中删除 armv6 是有原因的。
I have compiled armv7/armv6 with iOS5 SDK, however, the armv6 compiler produced wrong code in release mode. After hours of finding a workaround (trying llvm or gcc with different optimization levels) I give up.
我已经用 iOS5 SDK 编译了 armv7/armv6,但是,armv6 编译器在发布模式下生成了错误的代码。经过数小时的寻找解决方法(尝试使用不同优化级别的 llvm 或 gcc),我放弃了。
So, I am going back to iOS SDK 4.x as long as I support older armv6 devices.
所以,只要我支持旧的 armv6 设备,我就会回到 iOS SDK 4.x。
Example of code:
代码示例:
// myView center=(160, 100)
CGPoint p=myView.center;
// now p=(100,100) (what the heck?)
p.x=myView.center.x;
p.y=myView.center.y;
// now p=(160,100)
p.y+=100;
// now p =(200,200) (what the heck?)
Maybe I'm have some memory corruption, however, on the armv7 compiler and on iOSSDK < 5.0 it behaves as expected.
也许我有一些内存损坏,但是,在 armv7 编译器和 iOSSDK < 5.0 上,它的行为符合预期。
Best regards
此致
回答by Peter Johnson
Not sure if this is actually a solution yet, but I have discovered that replacing the defined string in "architectures", which was $(ARCHS_STANDARD_32_BIT), with "armv6 armv7" allowed me to compile with iOS5 as a base and iOS4 as a deployment target, and pass validation .
不确定这是否真的是一个解决方案,但我发现用“armv6 armv7”替换“架构”中定义的字符串,即 $(ARCHS_STANDARD_32_BIT) 允许我以 iOS5 作为基础和 iOS4 作为部署进行编译目标,并通过验证。
I am not using any IOS5-exclusive libraries or calls, but intend to in my next release.
我没有使用任何 IOS5 专有的库或调用,但打算在我的下一个版本中使用。
回答by Johan
I did not need to replace $(ARCHS_STANDARD_32_BIT) with just armv7 for the app to compile and be uploaded to the App Store.
我不需要将 $(ARCHS_STANDARD_32_BIT) 替换为 armv7 即可编译应用程序并将其上传到 App Store。
As suggested by MarkGranoff, I simply added armv6 as plain text, by hitting plus and just typing it in on line two.
正如 MarkGranoff 所建议的,我只是将 armv6 添加为纯文本,方法是点击加号并在第二行输入它。