Xcode 4.2如何将一个项目包含到另一个项目中? [英] Xcode 4.2 how include one project into another one?

查看:141
本文介绍了Xcode 4.2如何将一个项目包含到另一个项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找,但找不到关于如何将一个XCode项目及其所有子类包含到另一个项目中的清晰简单的解释。我经常在样本中看到类似的东西我从网上下载的项目,但不知道如何自己做。

I keep searching, but cannot find a clear and simple explanation on how to include one XCode project, along with all of it's sub-classes into another project. I routinely see stuff like that in sample projects that I download off the web, but do not know how to do this myself.

在XCode中,以及.h和.m文件和文件夹,有一个整个新项目,从蓝色xcode项目图标开始,可扩展以包含项目中的所有内容。

Within XCode, along with .h and .m files, and folders, there's a whole new project, starting with a blue xcode project icon, that is expandable to contain everything within the project.

请有人可以一步一步向我解释如何将一个XCode项目添加到另一个项目中需要做什么?我已经看过很多像标题搜索路径这样的内容,但这并没有告诉我多少。

Please, can someone explain to me step by step what do I need to do to add one XCode project into another one? I've seen a ton of one liners like "header search paths", but that does not tell me much.

更新:重新阅读文档后,我意识到要包含的项目必须拖到父项目的BLUE项目图标上。可以在任何地方拖动常规来源,但必须将项目拖到项目上。

UPDATE: After re-reading the documentation, I realized that the project to include must be dragged ONTO the BLUE project icon of the parent project. Regular sources can be dragged anywhere, but a project must be dragged onto a project.

谢谢!

推荐答案

当您尝试向xcode项目添加静态库时,这很有意义。这样做需要几个步骤。首先,确保静态库项目在XCode中打开。

This makes a lot of sense when you are trying to add a static library to your xcode projects. There are a couple steps required for doing this. First, make sure that the static library project is not open in XCode.

然后首先将静态库xcodeproj文件(从Finder中)拖放到应用程序的xcode项目中。

Then start by dragging and dropping the static library xcodeproj file (from the Finder) onto your app's xcode project.

此后你需要将此库添加到应用程序的构建阶段。单击主项目,然后选择目标的BuildPhases选项卡。

After this you need to add this library to your app's build phases. Click on the main project, and select the BuildPhases tab of the target.

您将要将其他项目添加到Target Dependencies和Link Binary With Libraries Section。

You're going to want to add the other project to the Target Dependencies and to your Link Binary With Libraries Section.

最后,应用程序需要知道您的标题。因此,您需要将静态库类的路径添加到用户标头搜索路径。转到主目标的构建设置并搜索标题搜索路径。

Finally, the app needs to be aware of your headers. Therefore, you need to add the path to your static libraries classes to your User Header Search Paths. Go to the Build Settings of the Main Target and search for Header Search Path.

这将使您的应用知道新的静态库。

This will make your app aware of the new static library.

有时您需要添加一些其他链接标志。在构建设置中搜索其他链接器标志并添加 -all_load -ObjC

Sometimes you need to add a few Other Linker Flags. In the Build Settings search for Other Linker Flags and add -all_load and -ObjC

希望这有帮助,我知道我第一次尝试这样做时,我的头撞在墙上一段时间。

Hope this helps, I know the first time I tried to do this I was banging my head against the wall for a while.

这篇关于Xcode 4.2如何将一个项目包含到另一个项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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