Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

ios - XCode 6.3.1 crashes while renaming project

I am using Xcode 6.3.1 for developing an iOS game using cocos2dx 2.2.6. I need to change the name of my iOS application.

I used to do it by pressing return key after clicking the project in XCode. It would open a dialog box which confirms where you want to change the name in the project.

Two days ago I updated Xcode and now when I press enter to change the name of the project it opens the dialog box and suddenly crashes.

If any one can find me an alternate method to change the application name for my iOS project I would be grateful. Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Updated: fixed step 4 to work properly with filenames containing spaces.

I've used shell commands to rename projects a few times, and it worked better than renaming from Xcode itself. Here are the steps (given we want to rename warnings_test => BestAppEver) (you may need to install a few extra tools with brew install rename ack):

  1. Find all files with name containing the source string:

    $ find . -name 'warnings_test*'
    ./warnings_test
    ./warnings_test.xcodeproj
    ./warnings_test.xcodeproj/xcshareddata/xcschemes/warnings_test.xcscheme
    ./warnings_testTests
    ./warnings_testTests/warnings_testTests.m
    
  2. Rename those files and directories:

    $ find . -name 'warnings_test*' -print0 | xargs -0 rename -S 'warnings_test' 'BestAppEver'
    

    You'll need to run this command a couple of times, because directories will be renamed first, then files and directories inside those will be renamed on the next iteration. Check with the step 1 if all the files are renamed (should see empty output).

  3. Find all occurrences of the string in all the files:

    $ ack --literal 'warnings_test'
    

    Look through the output to make sure all those string should be replaced. In most cases, they should.

  4. Replace all occurrences:

    $ ack --literal --files-with-matches 'warnings_test' --print0 | xargs -0 sed -i '' 's/warnings_test/BestAppEver/g'
    

    One run is enough. To verify, run the command in step 3 again, you should see empty output.

Done! All your targets, schemes, files, mentions in comments, identifiers, names, etc. have been renamed. If you git add . and git status, you should see a lot of renamed: entries (just another sanity check).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...