简体   繁体   English

Xcode 扩展中的所有项目名称和目标名称在哪里显示给用户?

[英]Where do all the Project Name and Target Names appear to a user in an Xcode extension?

I want to create a new Xcode Source Editor Extension .我想创建一个新的 Xcode Source Editor Extension This involves creating:这涉及创建:

  1. A new Xcode project.一个新的 Xcode 项目。
  2. A new Xcode Source Editor Extension target.一个新的 Xcode 源编辑器扩展目标。

Both require names obviously.显然,两者都需要名称。 I'm wondering where these names appear to help me decide how much context I should add to these names.我想知道这些名称出现在哪里可以帮助我决定应该为这些名称添加多少上下文。 For example, if it appears under a menu item of "Acme Corp", then calling it "Xcode Extensions" is sufficient.例如,如果它出现在“Acme Corp”的菜单项下,则称它为“Xcode Extensions”就足够了。 If it doesn't appear under such name, then including Acme in the title would make sense.如果它没有出现在这样的名称下,那么在标题中包含 Acme 是有意义的。

Furthermore, I tried changing the CFBundleDisplayName of the Target, and noticed that it doesn't update the Editor menu item name for some reason.此外,我尝试更改目标的 CFBundleDisplayName,并注意到由于某种原因它没有更新编辑器菜单项名称。

Where are all the places users will see these names and which settings control them?用户将在哪里看到这些名称以及控制它们的设置在哪里?

First, I'll define the following:首先,我将定义以下内容:

  • AppTarget: The Application's target, which was created when the new macOS application was created. AppTarget:应用程序的目标,在创建新的 macOS 应用程序时创建。
  • ExtensionTarget: The extension's target, which was created after adding the "Xcode Source Editor" target. ExtensionTarget:扩展的目标,在添加“Xcode Source Editor”目标后创建。

And, I'll assume you named the Application "MyApp" and the Extension "MyExtension".而且,我假设您将应用程序命名为“MyApp”,扩展名为“MyExtension”。

This sets up a project with the following options:这将设置一个具有以下选项的项目:

  • AppTarget > info.plist: AppTarget > info.plist:
    • CFBundleName = $(PRODUCT_NAME)
  • AppTarget > Build Settings: AppTarget > 构建设置:
    • Product Name = $(TARGET_NAME) (ie MyApp ) Product Name = $(TARGET_NAME) (即MyApp
  • ExtensionTarget/info.plist:扩展目标/info.plist:
    • CFBundleName = $(PRODUCT_NAME) (ie MyExtension ) CFBundleName = $(PRODUCT_NAME) (即MyExtension
    • CFBundleDisplayName = MyExtension

Here are all the places a user might see these names:以下是用户可能会看到这些名称的所有位置:

  • Application :应用

    • AppTarget/BuildSettings/ProductName

      This is the container.app the user installs/runs to get the extension.这是用户安装/运行以获取扩展的 container.app。

  • System Preferences > Extensions :系统偏好 > 扩展

    • AppTarget/BuildSettings/ProductName , in "Added Extensions". AppTarget/BuildSettings/ProductName ,在“添加的扩展”中。
    • AppTarget/BuildSettings/ProductName , underneath "Xcode Source Editor". AppTarget/BuildSettings/ProductName ,位于“Xcode 源代码编辑器”下方。
    • ExtensionTarget/info.plist/CFBundleDisplayName , in "Xcode Source Editor". ExtensionTarget/info.plist/CFBundleDisplayName ,在“Xcode 源代码编辑器”中。
  • Xcode > Editor menu : Xcode > 编辑器菜单

    • ExtensionTarget/info.plist/CFBundleName . ExtensionTarget/info.plist/CFBundleName

Some key things to note:需要注意的一些关键事项:

  • CFBundleName and CFBundleDisplayName for the ExtensionTarget appear in two different places, so they should probably be the same. ExtensionTarget 的CFBundleNameCFBundleDisplayName出现在两个不同的地方,所以它们应该是相同的。
  • From the user's perspective, they just care about the extension.从用户的角度来看,他们只关心扩展。 However, due to how extensions must be shipped with a.app, we must expose both an app and an extension to the user.但是,由于扩展必须与 a.app 一起提供,我们必须向用户公开应用和扩展。 They will therefore see both of those names in various places.因此,他们将在不同的地方看到这两个名字。 You might want to keep these name consistent as well.您可能还希望使这些名称保持一致。
  • Attempting to modify AppTarget/info.plist/CFBundleName directly appears to have no effect in what the user sees.尝试直接修改AppTarget/info.plist/CFBundleName似乎对用户看到的内容没有影响。 You must use the Product Name setting instead.您必须改用产品名称设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM