5

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

Wez
  • 10,555
  • 5
  • 49
  • 63
  • Out of curiosity I just tried renaming a new project in latest Xcode, using the file inspector, and Xcode says gathering information and then crashed! Possible bug I think. – Bamsworld Apr 23 '15 at 13:43
  • Yeah, same. If you know which version was working correctly you might use it for now on a separate (or virtual) machine, the only alternative I can see is to do all the work manually: you'll need to rename a few files and directories as well as modify the content of the project text-files, if you have two versions of the projects with minimum required changes any graphical source control tool would help a lot to inspect the differences. Also might want to submit a bug report and leave a reference here. – A-Live Apr 23 '15 at 13:54
  • If anybody can figure out the manual changes that need to be made in order to change the application name kindly guide me. – Nauman Minhas Apr 23 '15 at 14:37
  • "I need to change the name of my iOS application." Then why are you changing the project name? They have nothing to do with each other! Leave the project name alone. – matt Apr 23 '15 at 17:37
  • 1
    Xcode 6.3.2 fixes this, according to [the release notes](http://adcdownload.apple.com//Developer_Tools/Xcode_6.3.2_GM_seed/Xcode_6.3.2_GM_Seed_Release_Notes.pdf). – i_am_jorf May 13 '15 at 16:19
  • possible duplicate of [Xcode 6.3 is crashing on Project Rename](http://stackoverflow.com/questions/29692487/xcode-6-3-is-crashing-on-project-rename) – Khayrattee Wasseem May 23 '15 at 21:35

2 Answers2

11

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

eugene
  • 216
  • 2
  • 6
  • Thanks but I just needed to change the name and that turned out to be pretty easy. Thanks anyways – Nauman Minhas Apr 24 '15 at 13:43
  • 1
    @eugene step 4 I receive the following error : "sed: Completely: No such file or directory". Any idea why? – luca May 28 '15 at 16:12
  • @luca, thanks for your comment! Apparently, you're trying to rename a project containing spaces to another name containing spaces (meh!), but anyway I fixed the step 4, so it should work now. – eugene May 28 '15 at 19:26
  • @eugene Step 2, when using Cocoapods, some of the files/directories will have the name prepended with 'Pods-'. This means that you will have to search for the pattern '\*warnings_test\*' instead of 'warnings_test\*' – Marmoy Oct 20 '15 at 08:11
9

Don't change the project name. You should be able to without crashing, but the fact that you cannot do so does not matter. You don't need to change it, so don't. Leave the project name alone; it has nothing to do with anything the user ever sees. You want to change the name of the app, which is a completely different thing.

  • The name of the app, as shown below the icon on the device, is the CFBundleDisplayName setting (Bundle Display Name) in the Info.plist. That's all you need to change (you might need to create it).

  • The name of the app that users will see in the App Store is different yet again; that is something you will set manually in your browser at iTunes Connect when you submit the app.

EDIT: Apple has just (secretly) released Xcode 6.3.2 GM seed, which is said to fix the crashing bug.

FURTHER EDIT: Xcode 6.3.2 final (not the GM seed) really does appear to fix this crashing bug.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Thanks man. This was really helpful. It's exactly what I needed to do. – Nauman Minhas Apr 24 '15 at 13:42
  • I upvoted but "Don't change the project name" isn't a thoughtful suggestion. It's not just about what user sees, but then again Xcode, Macos and their bugs... – EralpB May 05 '15 at 11:28
  • @EralpB don't change the project name just in order to change the app name. That is very good advice. Don't change the project name until this crashing bug is fixed. That is good advice too. Now, if you foolishly put a comma in the project name, that advice doesn't apply to you... – matt May 05 '15 at 14:36
  • Matt's answer saved me tons and tons of headache. See Linh Nguyen answer on how to best change the display name: http://stackoverflow.com/questions/19594231/is-it-possible-to-change-the-name-of-an-ios-app-via-xcode – Qin Zhengquan May 18 '15 at 11:33