Xcode:添加项目作为构建依赖项

发布于 2024-10-03 17:55:23 字数 235 浏览 9 评论 0原文

我正在使用soundcloud api,在它的说明中它说要

  • 拖动SoundCloudAPI.xcodeproj 到您的项目中,
  • 将其添加为构建依赖项,

我可以轻松地将项目拖入其中,但如何完成下一步?

Im playing around with the soundcloud api, in its instructions it says to

  • drag SoundCloudAPI.xcodeproj into your project
  • add it as a build dependency

I can drag the project in pretty easily, but how does one accomplish the next step?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

落花浅忆 2024-10-10 17:55:23

要将其添加为依赖项,请执行以下操作:

  • 在 xcode 内的文件资源管理器中突出显示添加的项目。在右侧的目录浏览器窗口中,应该显示一个扩展名为 .a 的文件。目标栏下方有一个复选框(目标图标),选中它。
  • 右键单击您的目标(在文件资源管理器中的目标项下)并选择获取信息
  • 在常规选项卡上是直接依赖项部分。点击加号按钮
  • 选择项目并单击添加目标

To add it as a dependency do the following:

  • Highlight the added project in your file explorer within xcode. In the directory browser window to the right it should show a file with a .a extension. There is a checkbox under the target column (target icon), check it.
  • Right-Click on your Target (under the targets item in the file explorer) and choose Get Info
  • On the general tab is a Direct Dependencies section. Hit the plus button
  • Choose the project and click Add Target
江心雾 2024-10-10 17:55:23

对于像我这样的新手来说,这很困难 - 这是描述它的屏幕截图。
Xcode 10.2.1

“在此处输入图像描述"

Tough one for a newbie like me - here is a screenshot that describes it.
Xcode 10.2.1

enter image description here

颜漓半夏 2024-10-10 17:55:23
  1. 在左侧的导航器中选择您的项目。
  2. 打开中间窗格中的抽屉并选择您的目标。
  3. 可以选择“选择构建阶段目标依赖项”。
  4. 此时
  1. Select your project in the navigator on left.
  2. Open up the drawer in the middle pane and select your target.
  3. Select Build Phases
  4. Target Dependencies is an option at that point.
夜空下最亮的亮点 2024-10-10 17:55:23

在项目中的 TARGETS 下,右键单击您的项目目标(应与您的项目名称相同)并选择GET INFO,然后在GENERAL 选项卡上,您将看到DIRECT DEPENDENCIES,只需单击[+] 并选择SoundCloudAPI

Under TARGETS in your project, right-click on your project target (should be the same name as your project) and choose GET INFO, then on GENERAL tab you will see DIRECT DEPENDENCIES, simply click the [+] and select SoundCloudAPI.

看春风乍起 2024-10-10 17:55:23

只需关闭要添加的项目,然后拖放该文件即可。

Just close the Project you want to add , then drag and drop the file .

○闲身 2024-10-10 17:55:23

Xcode 添加项目作为依赖项

Xcode 10

  1. 将一个项目拖放到另一个项目中 - 称为跨项目引用[关于]
  2. 将添加的项目添加为构建依赖项 - 称为显式依赖项[关于]
//Xcode 10
Build Phases -> Target Dependencies -> + Add items 

//Xcode 11
Build Phases -> Dependencies -> + Add items 

选择要添加的项目:对话框中,您将仅看到项目中的目标和子项目

在此处输入图像描述

Xcode add a project as a dependency

Xcode 10

  1. drag-n-drop a project into another project - is called cross-project references[About]
  2. add the added project as a build dependency - is called Explicit dependency[About]
//Xcode 10
Build Phases -> Target Dependencies -> + Add items 

//Xcode 11
Build Phases -> Dependencies -> + Add items 

In Choose items to add: dialog you will see only targets from your project and the sub-project

enter image description here

新雨望断虹 2024-10-10 17:55:23

今天我遇到了同样的问题。
第一次运行的结果是我得到了下一个错误:

词法或预处理器问题:“SDKProjectName*/*SDKProjectName.h”
找不到文件。

但在运行之前,显然,我将 SDK 添加到了演示项目中,只需将 .xcodeproj 文件拖放到我的测试项目的源代码树中即可。之后,我进入主 xcodeproj 文件(演示)设置中的“构建阶段”选项卡,并将我的 SDK 添加为目标依赖项并将框架嵌入到相应的选项卡中。

但结果我得到了上面的错误!

因此,问题出在标题搜索路径选项上的空行中。我刚刚编写了 "../**" 作为此键的值,并且项目编译成功。因此,之后,您可以将 #include 添加到包含此 SDK 的任何项目中。

附注我的测试应用程序被创建到根 SDK 文件夹中。

Today I faced with the same problem.
As the result of the first run I got next error:

Lexical or Preprocessor Issue: 'SDKProjectName*/*SDKProjectName.h'
file not found.

But before running, I, obviously, added my SDK into the demo project, just drag&drop .xcodeproj file into my test project's source tree. After that, I moved into Build Phases tab in setting of the main xcodeproj file (of the demo) and added my SDK as target dependency and embed framework into corresponding tabs.

But at the result, I got an error above!

So, the problem was into empty line on the Header Search Paths option. I just wrote "../**" as value for this key and project compiled successfully. So, after that, you can add #include <SDKName/SDKName.h> into any project, which includes this SDK.

ps. My test app was created into root SDK folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文