简体   繁体   English

如何更改Xcode项目中的产品名称?

[英]How do I change the product name within an Xcode project?

I have an application that I would like to be called IFrames. 我有一个应用程序,我想称之为IFrames。 I've named all of the files appropriately (IFramesAppDelegate, etc.), but when I run it in ad hoc mode it shows up with the name "photoframes" instead. 我已经恰当地命名了所有文件(IFramesAppDelegate等),但是当我在ad hoc模式下运行时,它会显示名称为“photoframes”。

How did this happen and how do I change the name of the product to match the name I've provided for the project? 这是怎么发生的?如何更改产品名称以匹配我为项目提供的名称?

In XCode 4, on the Target properties, it is under the "Packaging" section, or you can just search for "Product Name". 在XCode 4中,在Target属性上,它位于“Packaging”部分下,或者您只需搜索“Product Name”。

在此输入图像描述

Do not set the product name on the project level, since your project can build several different applications. 不要在项目级别设置产品名称,因为您的项目可以构建多个不同的应用程序。 For example on iPhone/iPod touch app, and another iPad app fromt he same sources. 例如,在iPhone / iPod touch应用程序上,以及来自相同来源的另一个iPad应用程序。

Instead set the product name on the Target. 而是在Target上设置产品名称。 Find the Target in the Group & Files column in Xcode. 在Xcode的Group&Files列中找到Target。 And select "Get Info" from the context meny, or use the cmd-I shortcut. 并从上下文中选择“获取信息”,或使用cmd-I快捷方式。

目标

In the Info window go to the build tab. 在“信息”窗口中,转到“构建”选项卡。 Make sure Configuration is set to "All Configurations", since you want the same name for Debug and Release builds. 确保将Configuration配置为“All Configurations”,因为您希望Debug和Release版本具有相同的名称。 Filter down your options with "product name" to find the option fast, and type away. 使用“产品名称”过滤您的选项以快速找到该选项,然后输入。

目标信息中的产品名称

In Xcode 5, the Product Name defaults to the variable $(TARGET_NAME) which is linked to your Target Name. 在Xcode 5中,产品名称默认为变量$(TARGET_NAME) ,该变量链接到您的目标名称。

You can change your Target Name by clicking your Project in the Project Navigator, then clicking the target in the list under Targets, and hitting return . 您可以通过单击Project Navigator中的Project,然后单击Targets下列表中的目标,然后点击return来更改目标名称。

This part isn't necessary, but if you rename your project it will sit there annoying you every time you see it (like it did me all this morning)--the scheme name at the top when you compile the project will still have the old name. 这部分是没有必要的,但是如果你重命名你的项目,每次看到它都会让你烦恼(就像今天早上我做的那样) - 编译项目时顶层的方案名称仍然有旧名。 You can rename it too like this: 你可以像这样重命名它:

在此输入图像描述

Click the name and select Manage Schemes : 单击名称并选择Manage Schemes

在此输入图像描述

Click on the name and you can overwrite it: 单击名称,您可以覆盖它:

在此输入图像描述

You should check all setting/value in the "Project Info" & "Target Info" Pop-up. 您应该检查“项目信息”和“目标信息”弹出窗口中的所有设置/值。

Another solution, Right-Click on your .xcodeproj, Open the Dir (because it isn't a file), Open all files with text-edit and search/replace what you want :-) 另一个解决方案,右键单击.xcodeproj,打开目录(因为它不是文件),打开所有带文本编辑的文件并搜索/替换你想要的东西:-)

Good Luck ! 祝好运 !

您还可以通过在最新版本的XCode中选择Project-> Rename来更改整个项目名称。

Go to Project -> Edit Project Settings -> Select Build tab -> look for productName in packaging category.Change it to what you want. 转到项目 - >编辑项目设置 - >选择构建选项卡 - >在包装类别中查找productName。将其更改为您想要的。

Same way Change it in Edit Active Target Settings. 同样的方法在编辑活动目标设置中更改它。

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

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