使用静态库在 ios 项目中设置构建配置以在 xcode 4 中创建存档的正确方法是什么?

使用静态库在 ios 项目中设置构建配置以在 xcode 4 中创建存档的正确方法是什么?

问题描述:

我有一个工作应用程序,它依赖于几个静态库,我已将它们作为依赖项添加到应用程序中,并在构建阶段添加到带有静态库位的链接中.一切都在模拟器和我连接的 iPad 上构建和运行良好.

I have a working application which relies on several static libraries, which I've added as dependencies to the application and added to the link with static libraries bit in build phases. Everything builds and runs fine in the simulator and on my attached iPad.

我想创建一个用于试飞的 .ipa,所以我按照试飞网站上的说明进行操作 (http://support.testflightapp.com/kb/tutorials/how-to-create-an-ipa-xcode-4)和其他一些教程关于使用使用静态库的应用程序创建存档 (http://diaryofacodemonkey.ruprect.com/2011/03/18/ad-hoc-app-distribution-with-xcode-4/, http://www.musicalgeometry.com/?p=1237).

I wanted to create an .ipa for use with test flight so I followed the instructions on test flight's site (http://support.testflightapp.com/kb/tutorials/how-to-create-an-ipa-xcode-4) and some other tutorials relating to creating an archive with an app that uses static libraries (http://diaryofacodemonkey.ruprect.com/2011/03/18/ad-hoc-app-distribution-with-xcode-4/, http://www.musicalgeometry.com/?p=1237).

按照这些教程,当我创建档案时,我收到链接器错误,提示无法找到各种库,例如:ld:未找到用于 -lOAuthTouch 的库

Following these tutorials, when I create an archive I get linker errors about not being able to find various libraries, for example: ld: library not found for -lOAuthTouch

(我还尝试使用一个新项目和一个新的静态库项目,以确保它不是我更改的某些设置并且我遇到了同样的问题).

(I've also tried using a new project and a new static library project to make sure it's not some setting I've changed and I get the same problem).

这似乎是因为我在我的应用程序中添加了一个名为Ad Hoc"的构建配置以创建存档,并且基于链接器命令以及将Ad Hoc"配置添加到我使用的所有静态库的事实允许创建存档我假设正在将静态库构建到不同的目录.

This seems to be because I added a build configuration called "Ad Hoc" to my app for creating an archive, and based on the linker command and the fact that adding an "Ad Hoc" configuration to all the static libraries I use allows the archive to be created I'm assuming that the static libraries are being built to a different directory.

我不想为我使用的所有库添加新的构建配置,所以我的问题是,我应该怎么做才能在不修改我使用的每个库的情况下创建我的应用程序的存档?

I'd rather not have to add a new build configuration to all the libraries I use, so my question is, what should I do to create an archive of my app without tinkering with every library I use?

第二个相关问题:我提到的所有教程都说要将静态库的跳过安装"构建设置设置为是",但 Apple 文档(http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/DistApps/DistApps.html) 似乎表示为应用程序而不是库设置它.有人知道哪个是对的吗?

A second related question: all the tutorials I mentioned say to set the "Skip install" build setting to yes for static libraries, but the Apple documentation (http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/DistApps/DistApps.html) seems to indicate setting it for the application, rather than the libraries. Anyone know which is right?

它会起作用,您必须简单地获取正确的路径并确保在工作区中的每个静态库上都将 Skip install 设置为 NO.我最近经历了这个并最终从我的主要目标和每个静态库目标中删除了现有的 Ad hoc 分发配置.我在主项目和每个静态库项目上创建了一个新的临时配置,并验证了每个项目中的所有设置.

It will work, you must simply get the paths correct and make sure you have set Skip install to NO on each of the static libraries in the workspace. I recently went through this and ended up deleting the existing Ad hoc distribution configuration from both my main target and each of the static library targets. The I created a new ad hoc configuration on the main project and each static library project and verified all of the settings in each of them.

请参阅此链接这个,以及这个这有助于解决这个问题.

See this link, this, and this all of which helped with sort through this.