Xcode:基于架构的条件构建设置(Device(ARM)vs Simulator(i386)) [英] Xcode: Conditional Build Settings based on architecture (Device (ARM) vs Simulator (i386))

查看:182
本文介绍了Xcode:基于架构的条件构建设置(Device(ARM)vs Simulator(i386))的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个必须在模拟器和设备上运行的iPhone应用程序。但是我使用的外部编译库有一个版本的模拟器和一个设备(不同的CPU)。

I'm building an iPhone app that has to run on both the simulator and the device. However I'm using an externally compiled library that has one version for the simulator and one for the device (different CPU).

我该怎么办?我来自Visual C ++,所以我是Xcode的新手,我找不到办法。

How can I do it? I'm coming from Visual C++ so I'm new to Xcode, and I can't find the way to do it.

编辑,2016年3月:这个问题是在2009年7月,几乎6年前被问。从Xcode以来,很多已经改变,但我猜,一些东西仍然持有。例如,现在接受的答案在Xcode v3中不是一个选项。

EDIT, March 2016: this question was asked on July 2009, almost 6 years ago. Much has changed in Xcode since, but I guess some stuff still holds. The now-accepted answer, for example, wasn't an option in Xcode v3.

推荐答案

Omniture的AppMeasurement库,目前为3个体系结构编译:libAppMeasurement-iOSSimulator.a,libAppMeasurement-iOSDevice.a和libAppMeasurement-iOSDevice-armv7.a。

I had this problem when integrating Adobe Omniture's "AppMeasurement" library, which currently comes compiled for 3 architectures: libAppMeasurement-iOSSimulator.a, libAppMeasurement-iOSDevice.a, and libAppMeasurement-iOSDevice-armv7.a.

虽然这里的其他答案是基本上正确的,我最终必须去别的地方真正了解,然后解决这个问题。

While the other answers here are substantially correct, I ended up having to go elsewhere to truly understand and then fix the problem.

步骤1.理解问题

博客文章是解释整体问题的一个很好的工作。它给出了用于解决Xcode 3中的问题的开始到完成的指令 。请参阅下面的Xcode 4。

This blog post does a great job of explaining the overall issue. It gives start-to-finish instructions for solving the problem in Xcode 3. See below for Xcode 4.

注意:您可能会尝试跳过他说添加静态库然后删除它的位。下一次我这样做,我可能只是添加头文件,然后直接编辑其他链接器标志。

Note: You might try skipping the bit where he says to add the static libraries and then delete them. The next time I do this, I'll probably just add the header file(s), then skip straight to editing Other Linker Flags.

步骤2。 Xcode 4中的条件构建设置

StackOverflow页面解释了在Xcode 4中设置条件构建设置的新方法。提示:构建设置选项卡上的文本字段是拖放; -drop enabled;一旦您的条件构建设置已准备好在Other Linker Flags下编辑,您可以将静态库文件拖到文本字段上,Xcode将自动输入一个(希望相对的)路径。

This StackOverflow page explains the new way to set conditional build settings in Xcode 4. Tip: The text fields on the Build Settings tab are drag-&-drop enabled; once you have your conditional build setting ready for editing under Other Linker Flags, you can just drag the static library file right onto the text field and Xcode will automatically enter a (hopefully relative) path.

这是我的其他链接器标记的屏幕截图一旦我得到了缺少必要的架构i386警告消失,没有生成错误:

Here's a screenshot of my Other Linker Flags once I got the "missing required architecture i386" warning to go away with no build errors:


__

__

这篇关于Xcode:基于架构的条件构建设置(Device(ARM)vs Simulator(i386))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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