XCode 6.3.1 crashes while renaming project

前端 未结 2 742
忘了有多久
忘了有多久 2020-12-09 23:21

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

2条回答
  •  清歌不尽
    2020-12-09 23:51

    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).

提交回复
热议问题