在Xcode 3.x中如何重命名一个工程

在Xcode 3.x没有重命名一个工程的功能,需要我们手动解决。按下列步骤可真正彻底地重命名一个工程:

1、把要命名的工程的文件夹复制或改名成新的工程名;

2、在文件夹内把.pch和.xcodeproj 文件都改名为新的工程名;

3、删除build文件夹;

4、用TextMate或TextWrangler等文本编辑器打开.xcodeproj 文件,这个文件实际上是个文件夹,包含了三个或四个文件。(也可以从右键菜单选择“Show package contents”,这样就会显示这个文件夹中实际包含的文件,然后就可以用普通的文本编辑器打开了);

5、用文本编辑器打开第4步中所打开文件夹中的 <原工程名>.pbxproj 文件,把里面的“<原工程名>”字符串全部替换成新的工程名;

6、用XCode打开这个工程,执行一下Build或 “Clean all targets”操作。如果编译过程报一些错,则可以尝试先关闭XCode,然后重新打开试试。

 

原文出处:http://aplus.rs/programming/how-to-rename-project-in-xcode-3x/

 

======================================

方法二:

 

How To Rename An Xcode Project

<!-- end bloghead -->

      When you’re using Xcode to develop an iPhone app or a Mac app, you might decide that you need to rename your project.  In many cases this would mean not only renaming the actual executable file that gets produced, but also the names of various source code files, project folders, and the contents of various files within the project.

      As far as I can tell, Xcode provides no way to do this.  There are a few settings that seem like they might do part of it, but every time I tried to use one of them within Xcode, it just resulted in errors and my project failing to build.  After many hours and much frustration with Xcode, I decided to try it the Unix way, and it worked.  The solution is a straightforward 3-step process:

1. First I closed Xcode, and made a backup of my project folder.  Then I went into my project folder and renamed every file and folder which contained "OldName" so that it now contained "NewName" instead.  This could be scripted pretty easily but my current project is a small one so I spent the ~5 minutes to manually rename the files and folders.

2. In the project folder, I ran the following command in a terminal, to update the contents of the files in the project:

find . -type f -exec sed -i 's/OldName/NewName/g' "{}" \;

3. I opened the now-renamed project in Xcode and clicked Build -> Clean All Targets.

After that, the project (with the new name) built successfully.

 

原文出处: http://encodable.com/tech/blog/2009/05/16/How_To_Rename_An_Xcode_Project

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值