xcode 捆绑包名称、可执行文件名称、产品名称……还有其他吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3437330/
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-09 03:30:36  来源:igfitidea点击:

Bundle Name, Executable Name, Product Name...anything else?

iphonexcode

提问by tbarbe

Bundle Name, Executable Name, Product Name... any more??

捆绑包名称、可执行文件名称、产品名称……还有吗??

can someone please help clarify the use of each of these in Xcode on an iPhone project? They never fail to confuse the living bajezus out of me...and Im tired of getting them wrong.

有人可以帮助澄清在 iPhone 项目上使用 Xcode 中的每一个吗?他们总是把活生生的 bajezus 从我身上弄糊涂……而且我厌倦了把他们弄错了。

Someone please explain... why the hell do we need this many different naming schemes for one app environment? and what do I use each of these for so I can stick them in the right cubby hole in my head?

有人请解释一下......为什么我们需要为一个应用程序环境提供这么多不同的命名方案?我用这些来做什么,这样我就可以把它们塞进我脑袋里正确的小洞里?

采纳答案by Kendall Helmstetter Gelner

If you look at an info.plist, it goes something like this:

如果你查看 info.plist,它会是这样的:

Bundle Display Name - ${PRODUCT_NAME}
Executable File - ${EXECUTABLE_NAME}
Bundle Name - ${PRODUCT_NAME}

So you can see, that normally PRODUCT_NAME gives you the same name for the bundle and what the user sees.

所以您可以看到,通常 PRODUCT_NAME 为您提供相同的捆绑包名称和用户看到的名称。

In some cases you may want a more complex display name that is not suitable for naming things like bundles or executables, which is why you can change them independently - but you don't have to. The default is that PRODUCT_NAME is the same name as the project name, but you can also override it in the build settings.

在某些情况下,您可能需要更复杂的显示名称,该名称不适合命名包或可执行文件之类的内容,这就是您可以独立更改它们的原因 - 但您不必这样做。默认情况下 PRODUCT_NAME 与项目名称同名,但您也可以在构建设置中覆盖它。

You shouldn't be changing the way they are set up in info.plist, unless you have a very good reason... just change PRODUCT_NAME.

您不应该更改它们在 info.plist 中的设置方式,除非您有充分的理由……只需更改 PRODUCT_NAME。

回答by Nickolay Olshevsky

Bundle name- is folder name, where your app (including executable file and all resources) will be stored (Cool Program.app).

Bundle name- 是文件夹名称,您的应用程序(包括可执行文件和所有资源)将存储在其中(Cool Program.app)。

Executable name- is a program binary name, i.e. Cool Program.app/CoolProgram

Executable name- 是程序二进制名称,即 Cool Program.app/CoolProgram

Bundle display name- is what will be shown on iPhone screen, for example Cool Prog (since Cool Program probably will not fit on Springboard).

捆绑显示名称- 将在 iPhone 屏幕上显示的名称,例如 Cool Prog(因为 Cool Program 可能不适合 Springboard)。

And, Apple claims, that Bundle Display name must correspond to Bundle name, i.e. you cannot use bundle name TheApplication, and bundle display name Something Other

并且,Apple 声称,Bundle Display name 必须与 Bundle name 相对应,即您不能使用 bundle name TheApplication 和 bundle display name 其他东西

回答by Kiran Balegar

When you have a application with UI(eg: Calculator) then most of the above will be same and doesn't matter much but if your project output is just a bundle(some engine) then you can have different executables(apps/frontend with UI which uses ur bundle as backend) of your bundle that you can specify using different executable name. And ideally as Kendall said bundle name will be same as product name. Refer Xcode Build System Guide for better understanding. Hope this helps. :-).

当您有一个带有 UI 的应用程序(例如:计算器)时,上面的大部分内容都是相同的并且没有多大关系,但是如果您的项目输出只是一个包(某些引擎),那么您可以拥有不同的可执行文件(应用程序/前端与使用您的包作为后端的用户界面)您可以使用不同的可执行文件名称指定的包。理想情况下,正如 Kendall 所说,捆绑包名称将与产品名称相同。请参阅 Xcode Build System Guide 以获得更好的理解。希望这可以帮助。:-)。

回答by robm

There is also ${TARGET_NAME} - for example if you have one project that makes multiple targets with different 'Bundle Display Name's.

还有 ${TARGET_NAME} - 例如,如果您有一个项目使用不同的“捆绑显示名称”制作多个目标。

回答by Carol

According to Apple.com docs, it's exactly the opposite of what you'd expect.

根据 Apple.com 文档,这与您所期望的完全相反。

The "Display name" is the ACTUALname of the bundle.

“显示名称”是包的实际名称。

But the "Bundle name" is just the short "DISPLAY" name.

但“捆绑名称”只是“显示”名称的简称。

Actual cut/paste from Apple.com:

来自 Apple.com 的实际剪切/粘贴:

CFBundleName (Recommended, Localizable) The actual name of the bundle.

CFBundleDisplayName (Recommended, Localizable) The short display name of the bundle.

CFBundleName(推荐,可本地化)包的实际名称。

CFBundleDisplayName(推荐,可本地化)包的短显示名称。

Ugh.

啊。