Xcode-如何更改macOS应用程序的显示名称? [英] Xcode - How to change the display name of an app for macOS?

查看:300
本文介绍了Xcode-如何更改macOS应用程序的显示名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用程序的产品名称是将显示给客户的应用程序名称,您在启动新项目时在Xcode助手中选择了它,但是如果要更改它,该怎么办?

这似乎是一个琐碎的问题,但我尝试搜索,但发现了这样的旧答案

  • 您可以直接在构建设置中或通过 xcconfig 文件设置产品名称.我实际上更喜欢这种方式,因为您可以为不同的构建配置创建不同的名称,例如"MyApp Debug","MyApp Beta","MyApp".因此,只需将 $(TARGET_NAME) 替换为您的应用程序名称.之前进行构建设置

  • 之后进行构建设置

    The product name of the app is the name of your app as it will appear to customers and you choose it in the Xcode Assistant when starting a new project, but what if you would like to change it?

    It seems a trivial question but I tried searching and I find old answers like this one Changing Cocoa display name in the app? (seven years ago) or this one How to change the name of a Mac application in the build settings? which assumes you have a MainMenu.xib file, or answers that refer to iPhone as for example this answer (nine years ago) How to change the name of an iOS app? or this Apple's Technical note for iOS.

    Because many things may have changed in Xcode since seven or more years and macOS is different from iOS, I'm afraid to create some trouble, or to change the name that appears in some parts, but forget the old name in another place.

    What is the correct way to change the name that the user sees in an app for Mac?

    解决方案

    There are several ways to change the name of the app, after you have created the project:

    1. You can rename the target (Double click on the name) because by default Xcode uses the target name as product's name (see next screenshot).

    2. You can set the product name directly in the build settings or via xcconfig files. I actually prefer this way because you can create different names for different build configurations, e.g., "MyApp Debug", "MyApp Beta", "MyApp". So just replace the $(TARGET_NAME) with the name of your app.

    这篇关于Xcode-如何更改macOS应用程序的显示名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆