如何完全重命名Xcode项目(即包含文件夹)? [英] How do I completely rename an Xcode project (i.e. inclusive of folders)?
问题描述
我有一个名为 XXX
的项目。我想将此项目重命名为 YYY
。
I have a project named XXX
. I want to rename this project to YYY
.
请注意 XXX
是一个非常常见的术语(例如数据或简称项目),因此无法进行简单的RegEx搜索和替换,从而有可能破坏项目配置文件。
Note that XXX
is an extremely common term (for e.g. "data", or simply "project"), and thus a simple RegEx search-and-replace is not possible, out of risk of corrupting the project configuration files.
我当前的项目目录包含以下项目:
My current project directory contains the following items:
-
XXX
-
XXXTests
-
XXX。 xcodeproj
XXX
XXXTests
XXX.xcodeproj
我想将它们重命名为:
-
YYY
-
YYYTests
-
YYY.xcodeproj
YYY
YYYTests
YYY.xcodeproj
...分别在我的项目文件中反映了必要的更改。
... respectively, with the necessary changes being reflected in my project file.
如何在不必手动创建和填充新项目的情况下实现此目的?
How can I accomplish this without having to manually create and populate a new project?
推荐答案
步骤1 - 重命名项目
Step 1 - Rename the project
- 在项目导航器中单击要重命名的项目Xcode视图左侧。
- 在右侧选择文件检查器,项目名称应位于身份和类型下,将其更改为新名称。
- 点击下拉菜单中的重命名
第2步 - 重命名方案
Step 2 - Rename the Scheme
- 在顶部栏(停止按钮附近),有一个OLD产品方案,点击它,然后转到管理方案
- 点击方案中的旧名称,它将变为可编辑,更改名称
步骤3 - 使用您的资产重命名文件夹
Step 3 - Rename the folder with your assets
- 退出Xcode
- 在正确命名的主文件夹,有一个新命名的xcodeproj文件,其中包含错误命名的OLD文件夹。将OLD文件夹重命名为新名称
- 重新打开项目,您将看到警告:文件夹OLD不存在,忽略警告
- 在左侧的项目导航器中,单击顶级OLD文件夹名称
- 在身份和类型下的实用工具窗格中,您将看到名称条目,请更改此项从旧名称到新名称
- 下面是位置条目。单击具有OLD名称的文件夹并选择新重命名的文件夹
- Quit Xcode
- In the correctly named master folder, there is a newly named xcodeproj file with the the wrongly named OLD folder. Rename the OLD folder to your new name
- Reopen the project, you will see a warning: "The folder OLD does not exist", dismiss the warning
- In the "Project navigator" on the left, click the top level OLD folder name
- In Utilities pane under "Identity and type" you will see the "Name" entry, change this from the OLD to the new name
- Just below there is a "Location" entry. Click on a folder with the OLD name and chose the newly renamed folder
步骤4 - 重命名构建plist数据**
Step 4 - Rename the Build plist data**
- 点击左侧项目导航器中的项目,在主面板中选择构建设置
- 在本节中搜索plist
- 在包装下,您会看到
Info.plist
和产品包标识符
- 重命名
Info.plist中的顶部条目
- 为
产品标识符执行相同操作
- Click on the project in the "Project navigator" on the left, in the main panel select "Build Settings"
- Search for "plist" in this section
- Under packaging, you will see
Info.plist
, andProduct bundle identifier
- Rename the top entry in
Info.plist
- Do the same for
Product Identifier
最后,你已经完成并且可以重建( Command + Shift + K 来清理, Command + B 来构建)
Finally, you are done and can rebuild (Command + Shift + K to clean, Command + B to build)
这篇关于如何完全重命名Xcode项目(即包含文件夹)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!