如何在 Xcode 中更改工作区名称?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19949271/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change workspace name in Xcode?
提问by George
Is there any appropriate way to change workspace name in Xcode?
有什么合适的方法可以在 Xcode 中更改工作区名称吗?
Seems to me that it works to quit Xcode and manually change the .xcworkspace
file from OLD_NAME.xcworkspace
to NEW_NAME.xcworkspace
.
在我看来,它的工作原理退出Xcode和手动更改.xcworkspace
文件从OLD_NAME.xcworkspace
到NEW_NAME.xcworkspace
。
Xcode 5 was used at the time of writing.
在撰写本文时使用的是 Xcode 5。
采纳答案by trojanfoe
Yeah I reckon so. As far as I can see, a workspace is just a reference to one or more Xcode projects and doesn't produce anything outside of those projects.
是的,我也这么认为。据我所知,工作区只是对一个或多个 Xcode 项目的引用,不会在这些项目之外生成任何内容。
回答by MAhipal Singh
Steps to Rename Workspace
重命名工作区的步骤
- Rename the Folder( contain all files) of Main Project
- Rename the Workspace
- delete the Xcode project from Workspace and re-add/Drag Xcode project again to Workspace. And in build setting rename “product name”
- Now, In Workspace ,select the project in general , option for selecting infoPlist will appear, select the info plist of project. then, Click the Manage Scheme and Create New Scheme with Xcode Project Name , check the New Created Scheme and delete the older one.
- clear the both Xcode and Workspace ..and delete Derived Data “~/Library/Developer/Xcode”
- if project contain Bridging Header file then , just rename the Bridging Header file with With project name - “ProjectName-Bridging-Header.h” and then open the Xcode project not workspace. In build settings.. in “Swift Compiler -Code Generation”—> Objective-C Bridging Header — “reset the Path of Bridging header file”. close the Xocde. And if Project Contain Pod File , then open Pod file rename the target name with new project .close both xocde project and Workspace project and install the pod.
- now open the Workspace clean and build.
- 重命名主项目的文件夹(包含所有文件)
- 重命名工作区
- 从 Workspace 中删除 Xcode 项目,然后重新添加/将 Xcode 项目再次拖动到 Workspace。并在构建设置中重命名“产品名称”
- 现在,在 Workspace 中,选择一般项目,将出现选择 infoPlist 的选项,选择项目的 info plist。然后,单击 Manage Scheme 和 Create New Scheme with Xcode Project Name ,选中 New Created Scheme 并删除旧的。
- 清除 Xcode 和 Workspace ..并删除派生数据“~/Library/Developer/Xcode”
- 如果项目包含桥接头文件,那么只需使用项目名称 - “ProjectName-Bridging-Header.h”重命名桥接头文件,然后打开 Xcode 项目而不是工作区。在构建设置中..在“Swift Compiler -Code Generation”—> Objective-C Bridging Header—“重置桥接头文件的路径”。关闭 Xocde。如果 Project Contain Pod File ,则打开 Pod 文件,使用新项目重命名目标名称。关闭 xocde 项目和 Workspace 项目并安装 Pod。
- 现在打开工作区清理并构建。
回答by Fattie
2019:
2019年:
First note that this question is about changing the name of an Xcode workspace. The QA is not about changing the name of a project, a project within a workspace, the source folder, or other aspects of naming in the Xcode milieu.
首先请注意,这个问题是关于更改 Xcode工作区的名称。QA 不是要更改项目的名称、工作区中的项目、源文件夹或 Xcode 环境中命名的其他方面。
Xcode 11 and further.
Xcode 11 及更高版本。
Surprisingly, you can now just change the name of the file! As strange as that seems.
令人惊讶的是,您现在可以更改文件名!看起来很奇怪。
Quit Xcode. You must do this first.
Using your mouse, and keyboard, change the name:
退出 Xcode。你必须先这样做。
使用鼠标和键盘更改名称:
This causes no problem with Swift Package Manager or any other issue.
这不会导致 Swift Package Manager 或任何其他问题。
You now simply open the .xcworkspace file as normal.
您现在只需像往常一样打开 .xcworkspace 文件。
One part of a fifteen year old Apple problem resolved!
一个十五年前的苹果问题的一部分解决了!
回答by HenryRootTwo
I tried the same (XC6) but got a build error with one file not found. Not a huge issue, but for some it might not be worth the effort.
我尝试了相同的 (XC6),但出现构建错误,找不到一个文件。不是一个大问题,但对某些人来说可能不值得付出努力。
回答by d.ennis
In my case I had to rename also the project inside the workspacewhich had the same name.
在我的情况下,我还必须重命名工作区中具有相同名称的项目。
For that it was important before renaming the project to..
为此,在将项目重命名为..
- close Xcode
- rename the
.xcworkspace
-file from the Finder - open Xcode with new named workspace
- rename the project inside the workspace with Xcode help by clicking on the project name
- 关闭 Xcode
.xcworkspace
从 Finder重命名-file- 使用新命名的工作区打开 Xcode
- 通过单击项目名称,在 Xcode 帮助下重命名工作区中的项目
回答by Chander Shakher Ghorela - Guru
I want to change the workspace name, project name and all linked file with old project name, so I tried the steps from this post, and it's really helpful
我想用旧项目名称更改工作区名称、项目名称和所有链接文件,所以我尝试了这篇文章中的步骤,这真的很有帮助
https://medium.com/programming-lite/renaming-an-xcode-9-project-with-pods-the-easy-way-5d1228ef25a