How do I rename a project in Xcode 5? What steps do I need to take? In the past this was always a very tricky manual process.
如何在Xcode 5中重命名项目?我需要采取什么步骤?在过去,这一直是一个非常棘手的手工过程。
8 个解决方案
#1
292
Well, the answer is very very very Apple simple in Xcode 5! In the Project Navigator on the left side, click 2 x slowly and the Project file name will be editable. Type the new name. A sheet will appear with a warning and will list all the items Xcode 5 believes it should change. You can probably trust it, but you should inspect it. The list will include the info.plist and various files, but also all the relevant strings from nib/xib files like MainMenu menus.
答案在Xcode 5中非常非常简单!在左侧的Project Navigator中,缓慢地单击2 x,可以编辑项目文件名。输入新名称。表单将出现一个警告,并将列出Xcode 5认为应该更改的所有项。你可以相信它,但是你应该检查它。名单将包括信息。plist和各种文件,还有来自nib/xib文件的所有相关字符串,如主菜单菜单。
Accept the changes and you will get the prompt to save a snapshot of the project. Always make a snapshot when Xcode asks, it will be useful to restore if something does not work.
接受这些更改,您将得到保存项目快照的提示。当Xcode要求时,总是要做一个快照,如果某些东西不工作,它将会很有用。
#2
21
Change the project name:-
改变项目名称:-
- Click on the target in xcode, on the right in "Identify and Type" under name change the name and press the ENTER button on your keyboard.
- 单击xcode中的目标,在name下的“标识和键入”的右边更改名称并按键盘上的ENTER按钮。
- A window will appear confirming the change and what it will change. Once you confirm it will make the changes.
- 将出现一个窗口,确认更改及其更改内容。一旦确认,它将进行更改。
Change the root folder name:-
更改根文件夹名称:-
- Go to the project directory and rename the root folder,
- 转到项目目录,重命名根文件夹,
- Open the project and u will find all the file are missing, u need to add all the files of project again
- 打开项目,你会发现所有文件都丢失了,你需要重新添加项目的所有文件
- Right click the project bundle .xcodeproj file and select “Show Package Contents” from the context menu. Open the .pbxproj file with any text editor. 4>Search and replace any occurrence of the original folder name with the new folder name. 5>Save the file.
- 右键单击project bundle .xcodeproj文件,并从上下文菜单中选择“Show Package Contents”。使用任何文本编辑器打开.pbxproj文件。4>搜索和替换任何出现的原始文件夹名称与新的文件夹名称。5 >保存文件。
Change the Scheme name:-
改变计划名称:-
- rename .xscheme file
- 重命名.xscheme文件
If your Project is static framework then make sure your header file has public target membership
如果您的项目是静态框架,那么请确保您的头文件具有公共目标成员资格。
#3
4
I really recommend just opening the folder in a general editor such as Sublime Text, and doing a find/replace across the whole folder. The other methods I found were unstable, particularly when combined with .xcworkspace and cocoapods.
我真的建议在一般的编辑器中打开这个文件夹,比如“Sublime Text”,然后在整个文件夹中查找/替换。我发现的其他方法是不稳定的,尤其是与.xcworkspace和cocoapods结合使用时。
#4
4
In Xcode 8.0, to rename your project, just go through the following instructions as described in Xcode help:
在Xcode 8.0中,要重命名您的项目,只需按照Xcode help中描述的说明:
1- Select your project in the project navigator.
1-在项目导航中选择您的项目。
2- In the Identity and Type section of the File inspector, enter a new name into the Name field.
2-在文件检查器的标识和类型部分,在name字段中输入一个新名称。
3- Press Return.
3 -按Return键。
A dialog is displayed, listing the items in your project that can be renamed. The dialog includes a preview of how the items will appear after the change.
将显示一个对话框,列出项目中可以重命名的项目。该对话框包含更改后项目将如何显示的预览。
4- To selectively rename items, disable the checkboxes for any items you don’t want to rename. To rename only your app, leave the app selected and deselect all other items.
4-要有选择地重命名项目,请禁用您不想重命名的任何项目的复选框。要重命名您的应用程序,请保留选定的应用程序并取消选中所有其他项目。
5- Click Rename.
5 -点击重命名。
Source: http://help.apple.com/xcode/mac/8.0/#/dev3db3afe4f
来源:http://help.apple.com/xcode/mac/8.0/ / dev3db3afe4f
#5
3
Xcode 6 (beta 6 as of now) seems to be not very reliable with renaming projects. For me it didn't rename several of the files and groups. It also doesn't rename the physical folder the project is in. To rename my project to be sure that everything is clean I went the extra length to create a new project with the new name and copy over all the files. The assets are easy to copy but groups have to be recreated. The biggest issue with this however are CoreData data model files. Trying to simply copy this will result in a corrupt model file, even though everything looks like it is alright.
Xcode 6(到目前为止的beta 6)在重命名项目时似乎不太可靠。对我来说,它没有重命名几个文件和组。它也不会重命名项目所在的物理文件夹。为了重命名我的项目以确保一切都是干净的,我花了额外的时间来创建一个新项目,并在所有文件上复制新的名称。资产很容易复制,但是必须重新创建组。然而,最大的问题是CoreData数据模型文件。尝试简单地复制它将导致一个损坏的模型文件,即使看起来一切正常。
#6
0
When you re-name the project name in XCode5 then info.plist entry removed from Targets --- > General ---> identity. You just need to mention it again.
当您在XCode5中重新命名项目名称时,然后是info。plist条目从目标-->通用-->身份中删除。你只要再说一遍就行了。
#7
0
In Xcode 7, renaming a project can still break your app. Make sure you backed it up before trying it. Click on the project icon and find the project name in the inspector pane. If you change it there, Xcode will ask you if you want to rename related files. Might work. But if not, try this brute force approach:
在Xcode 7中,重命名一个项目仍然会破坏你的应用程序。单击项目图标,在inspector窗格中找到项目名称。如果您在那里更改它,Xcode将询问您是否要重命名相关文件。可能会奏效。但如果没有,试试这个蛮力方法:
- Close Xcode
- 关闭Xcode
- Using an advanced text editor like Sublime Text or Atom, open the root folder. It will open the folder structure.
- 使用高级的文本编辑器,如崇高的文本或原子,打开根文件夹。它将打开文件夹结构。
- Perform a Global Search and Replace (it's probably
cmd + shift + f
), and replaceMy Wrong App Name
withNew App
. If your project name contained spaces, also search forMy_Wrong_App_Name
and replace withNew_App
. This changes all file contents. - 执行全局搜索和替换(可能是cmd + shift + f),用新的应用程序替换我错误的应用程序名称。如果你的项目名称包含空格,也可以搜索my_error _app_name,然后用New_App替换。这将更改所有文件内容。
- Now you need to find all the files inside the project with your old app name. Rename them all, also the folders.
- 现在,您需要使用旧的应用程序名称找到项目中的所有文件。重命名它们,也重命名文件夹。
- Important: Open the project file with right click > Show Package Contents, and rename all files in there.
- 重要:打开项目文件,右键单击>显示包内容,并在其中重命名所有文件。
- Reopen your Xcode project or workspace. Compile.
- 重新打开Xcode项目或工作区。编译。
If you use Pods, you need to open the pods project as well and change the files in there.
如果您使用Pods,您还需要打开Pods项目并更改其中的文件。
#1
292
Well, the answer is very very very Apple simple in Xcode 5! In the Project Navigator on the left side, click 2 x slowly and the Project file name will be editable. Type the new name. A sheet will appear with a warning and will list all the items Xcode 5 believes it should change. You can probably trust it, but you should inspect it. The list will include the info.plist and various files, but also all the relevant strings from nib/xib files like MainMenu menus.
答案在Xcode 5中非常非常简单!在左侧的Project Navigator中,缓慢地单击2 x,可以编辑项目文件名。输入新名称。表单将出现一个警告,并将列出Xcode 5认为应该更改的所有项。你可以相信它,但是你应该检查它。名单将包括信息。plist和各种文件,还有来自nib/xib文件的所有相关字符串,如主菜单菜单。
Accept the changes and you will get the prompt to save a snapshot of the project. Always make a snapshot when Xcode asks, it will be useful to restore if something does not work.
接受这些更改,您将得到保存项目快照的提示。当Xcode要求时,总是要做一个快照,如果某些东西不工作,它将会很有用。
#2
21
Change the project name:-
改变项目名称:-
- Click on the target in xcode, on the right in "Identify and Type" under name change the name and press the ENTER button on your keyboard.
- 单击xcode中的目标,在name下的“标识和键入”的右边更改名称并按键盘上的ENTER按钮。
- A window will appear confirming the change and what it will change. Once you confirm it will make the changes.
- 将出现一个窗口,确认更改及其更改内容。一旦确认,它将进行更改。
Change the root folder name:-
更改根文件夹名称:-
- Go to the project directory and rename the root folder,
- 转到项目目录,重命名根文件夹,
- Open the project and u will find all the file are missing, u need to add all the files of project again
- 打开项目,你会发现所有文件都丢失了,你需要重新添加项目的所有文件
- Right click the project bundle .xcodeproj file and select “Show Package Contents” from the context menu. Open the .pbxproj file with any text editor. 4>Search and replace any occurrence of the original folder name with the new folder name. 5>Save the file.
- 右键单击project bundle .xcodeproj文件,并从上下文菜单中选择“Show Package Contents”。使用任何文本编辑器打开.pbxproj文件。4>搜索和替换任何出现的原始文件夹名称与新的文件夹名称。5 >保存文件。
Change the Scheme name:-
改变计划名称:-
- rename .xscheme file
- 重命名.xscheme文件
If your Project is static framework then make sure your header file has public target membership
如果您的项目是静态框架,那么请确保您的头文件具有公共目标成员资格。
#3
4
I really recommend just opening the folder in a general editor such as Sublime Text, and doing a find/replace across the whole folder. The other methods I found were unstable, particularly when combined with .xcworkspace and cocoapods.
我真的建议在一般的编辑器中打开这个文件夹,比如“Sublime Text”,然后在整个文件夹中查找/替换。我发现的其他方法是不稳定的,尤其是与.xcworkspace和cocoapods结合使用时。
#4
4
In Xcode 8.0, to rename your project, just go through the following instructions as described in Xcode help:
在Xcode 8.0中,要重命名您的项目,只需按照Xcode help中描述的说明:
1- Select your project in the project navigator.
1-在项目导航中选择您的项目。
2- In the Identity and Type section of the File inspector, enter a new name into the Name field.
2-在文件检查器的标识和类型部分,在name字段中输入一个新名称。
3- Press Return.
3 -按Return键。
A dialog is displayed, listing the items in your project that can be renamed. The dialog includes a preview of how the items will appear after the change.
将显示一个对话框,列出项目中可以重命名的项目。该对话框包含更改后项目将如何显示的预览。
4- To selectively rename items, disable the checkboxes for any items you don’t want to rename. To rename only your app, leave the app selected and deselect all other items.
4-要有选择地重命名项目,请禁用您不想重命名的任何项目的复选框。要重命名您的应用程序,请保留选定的应用程序并取消选中所有其他项目。
5- Click Rename.
5 -点击重命名。
Source: http://help.apple.com/xcode/mac/8.0/#/dev3db3afe4f
来源:http://help.apple.com/xcode/mac/8.0/ / dev3db3afe4f
#5
3
Xcode 6 (beta 6 as of now) seems to be not very reliable with renaming projects. For me it didn't rename several of the files and groups. It also doesn't rename the physical folder the project is in. To rename my project to be sure that everything is clean I went the extra length to create a new project with the new name and copy over all the files. The assets are easy to copy but groups have to be recreated. The biggest issue with this however are CoreData data model files. Trying to simply copy this will result in a corrupt model file, even though everything looks like it is alright.
Xcode 6(到目前为止的beta 6)在重命名项目时似乎不太可靠。对我来说,它没有重命名几个文件和组。它也不会重命名项目所在的物理文件夹。为了重命名我的项目以确保一切都是干净的,我花了额外的时间来创建一个新项目,并在所有文件上复制新的名称。资产很容易复制,但是必须重新创建组。然而,最大的问题是CoreData数据模型文件。尝试简单地复制它将导致一个损坏的模型文件,即使看起来一切正常。
#6
0
When you re-name the project name in XCode5 then info.plist entry removed from Targets --- > General ---> identity. You just need to mention it again.
当您在XCode5中重新命名项目名称时,然后是info。plist条目从目标-->通用-->身份中删除。你只要再说一遍就行了。
#7
0
In Xcode 7, renaming a project can still break your app. Make sure you backed it up before trying it. Click on the project icon and find the project name in the inspector pane. If you change it there, Xcode will ask you if you want to rename related files. Might work. But if not, try this brute force approach:
在Xcode 7中,重命名一个项目仍然会破坏你的应用程序。单击项目图标,在inspector窗格中找到项目名称。如果您在那里更改它,Xcode将询问您是否要重命名相关文件。可能会奏效。但如果没有,试试这个蛮力方法:
- Close Xcode
- 关闭Xcode
- Using an advanced text editor like Sublime Text or Atom, open the root folder. It will open the folder structure.
- 使用高级的文本编辑器,如崇高的文本或原子,打开根文件夹。它将打开文件夹结构。
- Perform a Global Search and Replace (it's probably
cmd + shift + f
), and replaceMy Wrong App Name
withNew App
. If your project name contained spaces, also search forMy_Wrong_App_Name
and replace withNew_App
. This changes all file contents. - 执行全局搜索和替换(可能是cmd + shift + f),用新的应用程序替换我错误的应用程序名称。如果你的项目名称包含空格,也可以搜索my_error _app_name,然后用New_App替换。这将更改所有文件内容。
- Now you need to find all the files inside the project with your old app name. Rename them all, also the folders.
- 现在,您需要使用旧的应用程序名称找到项目中的所有文件。重命名它们,也重命名文件夹。
- Important: Open the project file with right click > Show Package Contents, and rename all files in there.
- 重要:打开项目文件,右键单击>显示包内容,并在其中重命名所有文件。
- Reopen your Xcode project or workspace. Compile.
- 重新打开Xcode项目或工作区。编译。
If you use Pods, you need to open the pods project as well and change the files in there.
如果您使用Pods,您还需要打开Pods项目并更改其中的文件。