前几天我用一个愚蠢的开发代码开始了一个iPhone项目,现在我想改变这个项目的名称,因为它快要完成了。我该怎么做呢?


当前回答

如果您需要在iPhone主屏幕上更改应用程序的名称,则需要在Target配置中进行,而不是在项目配置中进行。

Expand the Targets group in Xcode, and then single-click the item under that. It should share the name of your project, which is also the default name of the application that gets generated. Press Command + I to bring up the Info window, and then navigate to the Build tag. Set the Configuration drop-down to read All Configurations. Look for a setting called Product Name under the Packaging heading. Change that value to the name you want for your compiled applications and, in the immortal words of Bugs Bunny: Voilà! Do a clean and a build. Your application will take on the new name.

其他回答

对于Xcode 10.2:

虽然这个问题有很多答案,但我想详细解释整个概念,以便每个人都可以将这些知识应用到进一步或以前的Xcode版本中。

每个Xcode项目都由一个或多个目标组成。根据apple的说法,目标指定要构建的产品,并包含从项目或工作区中的一组文件构建产品的说明。所以每个目标都是一个独立的产品(应用程序)。

更改名称的步骤:

步骤1:进入Targets,打开要更改名称的目标器的Info选项卡。

第二步:查看自定义iOS目标属性下的Bundle名称键,该键被设置为默认属性$(PRODUCT_NAME)。

第三步:你可以直接更改Bundle名称(不推荐),或者如果你打开Build Settings选项卡,然后在Setting下搜索Product name,你会看到Product name被设置为$(TARGET_NAME)。

步骤3A:您可以更改产品名称,也可以通过双击目标更改目标名称。

所以改变产品名称(应用名称)或目标名称都会产生相似的结果。但如果你只想更改应用程序名称,并希望继续使用相同的目标名称,则只需更改产品名称。

Xcode 7/8吗?它在目标使用的plist中

您可以在不更改项目名称(特别是目录)的情况下修改产品名称。

构建设置>搜索关键字“产品名称”>更新值

选择左边最上面的一行(包含项目名称、目标数量等)。 选择要重命名的目标。 再次单击目标的名称。 键入新名称。 按回车。

在Xcode中打开目标。 在项目的目标(您当前的开发名称)上构建设置。 在包装下搜索产品名称。将其值更改为您想要的新项目名称。