简体   繁体   English

如何使用iOS 5为armv6和armv7架构构建

[英]How to build for armv6 and armv7 architectures with iOS 5

In iOS5 Apple drops the armv6 architecture from the ARCHS_STANDARD_32_BIT . iOS5中, Apple从ARCHS_STANDARD_32_BIT中删除了armv6架构。

In order to keep the support for iPhone3G I still want to compile in armv6 even in iOS5. 为了保持对iPhone3G的支持,即使在iOS5中,我仍然想在armv6中进行编译。

Did anyone find a solution for this? 有人找到解决方案了吗?

I just built something today specifying a deployment target of iOS 4.0. 我今天刚刚构建了一些东西,指定了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. 在仅在Architectures中指定armv7的情况下,Xcode警告我,要支持iOS4.2以下的任何内容,我必须在Architectures中包括armv6。 Just edit that field, click the "+" button when the dialog pops up and enter the literal "armv6". 只需编辑该字段,在对话框弹出时单击“ +”按钮,然后输入文字“ armv6”。

In my case, we want our app to work under iOS4 and iOS5. 就我而言,我们希望我们的应用程序可以在iOS4和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. 我们必须进行一些修改,才能在iOS5下正常工作,但是所有这些更改都是通过iOS4友好的代码更改完成的。

We also added some iOS5-specific capabilities in a manner that allows the app to run without crashing under iOS4. 我们还添加了一些特定于iOS5的功能,以使应用程序在iOS4下运行而不会崩溃的方式。 Specifically, we tested for iOS5 capabilities before trying to use them, and linked iOS5-only libraries as Optional. 具体来说,我们在尝试使用iOS5功能之前进行了测试,并将仅iOS5的库链接为可选。

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". 因此,在iOS5世界中支持iPhone3G可能很容易意味着“我们希望我们的应用程序在iOS4及更高版本上运行(无论使用任何iOS5功能)”,而不是“我们希望确保我们的应用程序在运行iOS5的旧设备上运行”。 There's a difference here; 这里有所不同; think about it. 考虑一下。 :-) :-)

Anyway, adding armv6 support back in is very easy. 无论如何,重新添加armv6支持非常容易。 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. 我想说的是:在某个时候,当没有更多的armv6设备需要担心时(无论出于何种原因),您都不必为此而构建。 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. 而且我猜Xcode开发团队也知道这一点,这就是为什么您可以很简单地添加armv6支持的原因。

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". 简单的答案是,您必须将当前设置从“标准(armv7)-$(ARCHS_STANDARD_32_BIT)”更改为“ armv6”和“ armv7”。 See the image below. 参见下图。 You have to delete the line with the previous settings for it to work. 您必须先删除具有先前设置的行,然后才能使用它。

正确设置armv6和armv7

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

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. 我已经使用iOS5 SDK编译了armv7 / armv6,但是armv6编译器在发布模式下生成了错误的代码。 After hours of finding a workaround (trying llvm or gcc with different optimization levels) I give up. 经过数小时的解决方法(尝试使用不同的优化级别尝试llvm或gcc)后,我放弃了。

So, I am going back to iOS SDK 4.x as long as I support older armv6 devices. 因此,只要支持较旧的armv6设备,我将返回iOS SDK4.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 最好的祝福

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”替换“ architectures”中的已定义字符串($(ARCHS_STANDARD_32_BIT)),使我可以将iOS5作为基础,将iOS4进行部署定位并通过验证。

I am not using any IOS5-exclusive libraries or calls, but intend to in my next release. 我没有使用任何IOS5专有的库或调用,但是打算在下一个版本中使用。

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. 我不需要用armv7替换$(ARCHS_STANDARD_32_BIT)即可编译应用程序并将其上传到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添加为纯文本,只需点击加号并在第二行中键入它即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM