Xcode MacOS 在哪里存储需要的二进制文件

Xcode MacOS where to store binary file that's needed

我有一个用 C 编写的可执行文件,它输出我的 Cocoa 应用程序中需要的一些信息。我的问题是我应该将这个可执行文件存储在我的项目中的什么位置?当我发布应用程序时,它将存储在什么路径?

我已阅读有关 Application Support 文件夹的信息。打印出来

print(FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first)

让我明白

Optional(file:///Users/cemal/Library/Containers/noorganization.ProjectName/Data/Library/Application%20Support/)

这是存储我的二进制文件的地方吗?如果是,我现在必须在构建时将其存储在哪里,以便将其存储在 Application Support 文件夹中?

您可能希望将额外的二进制文件存储在 .app 包中的 MacOS 目录中 — 将其存储在其他地方可能会产生问题,尤其是当它是一个可能无法访问的位置时。

.app/Contents/MacOS

Typically, this directory contains only one binary file with your application’s main entry point and statically linked code. However, you may put other standalone executables (such as command-line tools) in this directory as well.

Bundle Programming Guide : Bundle Structures