Xcode 4.2如何将一个项目包含到另一个项目中?

时间:2022-06-10 11:29:15

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项目以及它的所有子类包含到另一个项目的清晰和简单的解释。我经常在我从网上下载的样例项目中看到类似的东西,但我自己不知道怎么做。

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中,除了.h和.m文件和文件夹之外,还有一个全新的项目,从一个蓝色的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.

拜托,能不能有人一步一步地向我解释一下,要把一个XCode项目添加到另一个项目中,我需要做些什么?我见过很多类似“头搜索路径”这样的内衬,但这并不能说明什么。

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.

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

Thank you!

谢谢你!

5 个解决方案

#1


129  

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.

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

Then start by dragging and dropping the static library xcodeproj file (from the Finder) onto your app's xcode project. Xcode 4.2如何将一个项目包含到另一个项目中?

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

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.

之后,您需要将这个库添加到应用程序的构建阶段。单击主项目,并选择目标的buildstage选项卡。

Xcode 4.2如何将一个项目包含到另一个项目中?

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

您将希望将另一个项目添加到目标依赖项中,并将其添加到与Libraries相关的链接二进制文件中。

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.

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

Xcode 4.2如何将一个项目包含到另一个项目中?

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

这将使您的应用程序意识到新的静态库。

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

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

Xcode 4.2如何将一个项目包含到另一个项目中?

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

希望这能有所帮助,我知道我第一次试着这么做的时候,我的头撞到了墙上。

#2


4  

You can just drag-and-drop any xcode-project file (*.xcodeproj) into the project navigation pane of your desired parent-project.

您可以将任何xcode-project文件(*.xcodeproj)拖放到所需的父项目的项目导航窗格中。

You then may need to add target dependencies, depending on your needs.

然后,您可能需要根据需要添加目标依赖项。

Is that what you mean?

你是这个意思吗?

#3


3  

Make sure to choose "create groups" instead of "create folder references". If your folder is blue instead of yellow, then you have a folder reference. The folder should be yellow.

确保选择“创建组”而不是“创建文件夹引用”。如果你的文件夹是蓝色而不是黄色的,那么你有一个文件夹参考。文件夹应该是黄色的。

#4


2  

Make sure the project you want to add as subproject it's not open, before you add it or drop it.

在添加或删除项目之前,确保您想要添加的项目作为子项目没有打开。

#5


1  

drag and drop xcode file to another xcode file from finder. It will ask you for copy the file then check the check box and it will copy to your project.

将xcode文件拖放到finder的另一个xcode文件中。它会要求你复制文件,然后勾选复选框,它会复制到你的项目中。

#1


129  

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.

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

Then start by dragging and dropping the static library xcodeproj file (from the Finder) onto your app's xcode project. Xcode 4.2如何将一个项目包含到另一个项目中?

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

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.

之后,您需要将这个库添加到应用程序的构建阶段。单击主项目,并选择目标的buildstage选项卡。

Xcode 4.2如何将一个项目包含到另一个项目中?

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

您将希望将另一个项目添加到目标依赖项中,并将其添加到与Libraries相关的链接二进制文件中。

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.

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

Xcode 4.2如何将一个项目包含到另一个项目中?

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

这将使您的应用程序意识到新的静态库。

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

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

Xcode 4.2如何将一个项目包含到另一个项目中?

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

希望这能有所帮助,我知道我第一次试着这么做的时候,我的头撞到了墙上。

#2


4  

You can just drag-and-drop any xcode-project file (*.xcodeproj) into the project navigation pane of your desired parent-project.

您可以将任何xcode-project文件(*.xcodeproj)拖放到所需的父项目的项目导航窗格中。

You then may need to add target dependencies, depending on your needs.

然后,您可能需要根据需要添加目标依赖项。

Is that what you mean?

你是这个意思吗?

#3


3  

Make sure to choose "create groups" instead of "create folder references". If your folder is blue instead of yellow, then you have a folder reference. The folder should be yellow.

确保选择“创建组”而不是“创建文件夹引用”。如果你的文件夹是蓝色而不是黄色的,那么你有一个文件夹参考。文件夹应该是黄色的。

#4


2  

Make sure the project you want to add as subproject it's not open, before you add it or drop it.

在添加或删除项目之前,确保您想要添加的项目作为子项目没有打开。

#5


1  

drag and drop xcode file to another xcode file from finder. It will ask you for copy the file then check the check box and it will copy to your project.

将xcode文件拖放到finder的另一个xcode文件中。它会要求你复制文件,然后勾选复选框,它会复制到你的项目中。