简体   繁体   中英

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 . This involves creating:

  1. A new Xcode project.
  2. A new Xcode Source Editor Extension target.

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. If it doesn't appear under such name, then including Acme in the title would make sense.

Furthermore, I tried changing the CFBundleDisplayName of the Target, and noticed that it doesn't update the Editor menu item name for some reason.

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.
  • ExtensionTarget: The extension's target, which was created after adding the "Xcode Source Editor" target.

And, I'll assume you named the Application "MyApp" and the Extension "MyExtension".

This sets up a project with the following options:

  • AppTarget > info.plist:
    • CFBundleName = $(PRODUCT_NAME)
  • AppTarget > Build Settings:
    • Product Name = $(TARGET_NAME) (ie MyApp )
  • ExtensionTarget/info.plist:
    • CFBundleName = $(PRODUCT_NAME) (ie 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.

  • System Preferences > Extensions :

    • AppTarget/BuildSettings/ProductName , in "Added Extensions".
    • AppTarget/BuildSettings/ProductName , underneath "Xcode Source Editor".
    • ExtensionTarget/info.plist/CFBundleDisplayName , in "Xcode Source Editor".
  • Xcode > Editor menu :

    • 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.
  • 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. 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. You must use the Product Name setting instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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