xcode Xcode如何添加外部项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11036921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:36:24  来源:igfitidea点击:

Xcode how to add an external project

xcodeworkspacebuild-dependencies

提问by Daniel

I need to add an external project to my Xcode project, the reason for this is I need to add a Target Dependency on that external projects static library.

我需要向我的 Xcode 项目添加一个外部项目,原因是我需要在该外部项目静态库上添加一个目标依赖项。

I can't seem to add it in the way I need, I would like it like this:

我似乎无法按照我需要的方式添加它,我希望它是这样的:

enter image description here

在此处输入图片说明

However, when I add another project to my actual Xcode project I get the following which doesn't let me explore that project from my one and so I can't add the dependency I need.

但是,当我将另一个项目添加到我的实际 Xcode 项目时,我得到以下内容,这不允许我从我的项目中探索该项目,因此我无法添加我需要的依赖项。

enter image description here

在此处输入图片说明

Note that these screenshots are from two different projects, and in the one which is showing me what I want to reproduce in my own project, dragging in multiple projects works as expected.

请注意,这些屏幕截图来自两个不同的项目,其中一个向我展示了我想在我自己的项目中重现的内容,拖入多个项目按预期工作。

Maybe I have some settings set up wrong in my project ? All I've done is take a template detail-master application from Xcode.

也许我的项目中有一些设置错误?我所做的只是从 Xcode 中获取模板 detail-master 应用程序。

回答by gcamp

You did it right. The problem is that Xcode cannot have the same project opened twice.

你做对了。问题是 Xcode 不能让同一个项目打开两次。

Close Serenity.xcodeprojbefore reopening your parent project.

Serenity.xcodeproj在重新打开父项目之前关闭。

回答by James Webster

Yes, this is possible, it's called a workspace.

是的,这是可能的,它被称为工作区。

In your example:

在你的例子中:

  • Open both of your projects
  • Drag the Serenity project into the Dependant project
  • 打开你的两个项目
  • 将 Serenity 项目拖入 Dependent 项目

I think what you are doing wrong is dragging the Xcodeproj, try opening that project and dragging the project block instead (see pic)

我认为您做错的是拖动 Xcodeproj,尝试打开该项目并拖动项目块(见图)

enter image description here

在此处输入图片说明