我有一个项目叫XXX。我想把这个项目重命名为YYY。

请注意,XXX是一个非常常见的术语(例如:“数据”,或者简单的“项目”),因此一个简单的RegEx搜索和替换是不可能的,因为有破坏项目配置文件的风险。

我的当前项目目录包含以下项目:

XXX XXXTests XXX . xcodeproj

我想把它们重命名为:

年年 年 YYY.xcodeproj

... 分别与必要的变化反映在我的项目文件。

我如何才能在不手动创建和填充新项目的情况下实现这一点呢?


当前回答

除了Luke和Vaiden推荐的所有步骤之外,我还必须重命名Storyboard中的所有customModule属性以匹配新名称,并且这必须区分大小写。

其他回答

更改项目名称;

在project导航器中选择您的项目。 在文件检查器的Identity and Type部分中,在name字段中输入一个新名称。 按Return键。 将显示一个对话框,列出项目中可以重命名的项。该对话框包括更改后项目将如何显示的预览。 若要选择性地重命名项,请禁用不想重命名的任何项的复选框。若要仅重命名应用程序,请保持应用程序已选中,并取消选择所有其他项。 按“重命名”

为卢克-韦斯特的精彩回答补充一点:

使用CocoaPods时

第二步之后:

Xcode辞职。 在主文件夹中,重命名OLD。xcworkspace到NEW.xcworkspace。

第四步之后:

In Xcode: choose and edit Podfile from the project navigator. You should see a target clause with the OLD name. Change it to NEW. Quit Xcode. In the project folder, delete the OLD.podspec file. rm -rf Pods/ Run pod install. Open Xcode. Click on your project name in the project navigator. In the main pane, switch to the Build Phases tab. Under Link Binary With Libraries, look for libPods-OLD.a and delete it. If you have an objective-c Bridging header go to Build settings and change the location of the header from OLD/OLD-Bridging-Header.h to NEW/NEW-Bridging-Header.h Clean and run.

除了Luke和Vaiden推荐的所有步骤之外,我还必须重命名Storyboard中的所有customModule属性以匹配新名称,并且这必须区分大小写。

我在网上找到了一些有用的简单步骤:

in Finder change project's folder name open project/select project file in Xcode navigator/show the file inspector/under Identity and Type change Name as per your preference/Enter/wait few seconds till pop-up window appears/click rename/again wait few seconds - do not push OK/ select folder under project file in Xcode navigator/show the file inspector/under Identity and Type change name as per your preference/Enter/wait few secont till file under project file in Xcode nagivator changes its name in Xcode project status bar click on the project name (it appears when you hover over the beginning of line)/choose Manage schemes...till "Autocreate schemes" window shows up/2x click on project name under scheme column/enter/close "Autocreate schemes" window select project file in Xcode navigator/inXcode editor ~ interface builder area choose tab "Build setting"/in filter type the previous name of your project/click enter/in the line(s) where the previous name of your project appears within the root(s) - just change it to new name voala that's it

加入卢克·韦斯特的公认答案。如你有任何权益:

关闭Xcode 更改授权文件名 进入Xcode,选择授权文件应该突出显示为红色,在文件检查器中选择文件夹图标,并选择您的重命名文件。 进入构建设置,搜索“授权”并更新授权的文件夹名称和文件名。 清洁和重建