Renaming projects in Xcode 4

前端 未结 11 1918
猫巷女王i
猫巷女王i 2020-11-27 09:22

I must be missing something obvious, but I can\'t figure out how to rename my project in Xcode 4.

If I remember correctly Xcode 3 had a dedicated menu item for this

相关标签:
11条回答
  • 2020-11-27 10:10

    Renaming the project is really the best way to go.

    Here's what I do In Xcode 4.3.2:

    • Duplicate original project in finder
    • Open the project file in the new folder.
    • Select project (little blue icon)
    • Click again and enter new project name. This makes reasonable choices like changing the target, changing the project filename and all appropriate references.

    I make custom accessories with a bunch similar backend frameworks and icons. Nothing is perfect but this is a fast way to save a bunch of configuration clicks when apps have a lot of similarities.

    0 讨论(0)
  • 2020-11-27 10:11

    EDIT 10/10/19: There is an awesome tool to rename projects in Xcode, I tried it and it works great:

    https://github.com/appculture/xcode-project-renamer


    I'm posting this since I have always been struggling when renaming a project in XCode.

    Renaming the project is good and simple but this doesn't rename the source folder. Here is a step by step of what I have done that worked great in Xcode 4 and 5 thanks to the links below.

    REF links:
    Rename Project.
    Rename Source Folder and other files.

    1- Backup your project. If you are using git, commit any changes, make a copy of the entire project folder and backup in time machine before making any changes.

    2- Open your project.

    3- Slow double click or hit enter on the Project name (blue top icon) and rename it to whatever you like.

    NOTE: After you rename the project and press ‘enter’ it will suggest to automatically change all project-name-related entries and will allow you to de-select some of them if you want. Select all of them and click ok.

    4- Rename the Scheme a)Click the menu right next to the stop button and select Manage Schemes. b)Single-slow-click or hit enter on the old name scheme and rename it to whatever you like. c)Click ok.

    5 - Build and run to make sure it works.

    NOTES: At this point all of the important project files should be renamed except the comments in the classes created when the project was created nor the source folder. Next we will rename the folder in the file system.

    6- Close the project.

    7- Rename the main and the source folder.

    8- Right click the project bundle .xcodeproj file and select “Show Package Contents” from the context menu. Open the .pbxproj file with any text editor.

    9-Search and replace any occurrence of the original folder name with the new folder name.

    10- Save the file.

    11- Open XCode project, test it.

    12- Done.

    0 讨论(0)
  • 2020-11-27 10:12

    There is one other way.

    To rename a project in Xcode 4, select the project file from the project navigator on the left side of the project window. Choose View > Utilities > File Inspector to open the file inspector on the right side of the project window. At the top of the file inspector is the Project Name text field. Enter a new project name and press the Return key or the Tab key.

    A sheet opens asking if you want to rename the project content items. Click the Rename button to finish renaming the project.

    0 讨论(0)
  • 2020-11-27 10:15

    In addition to renaming the project, you may want rename the scheme so that it matches your new project name.

    Xcode scheme name

    To change the name of your scheme:

    Product ==> Manage Schemes...

    Then select your scheme and hit return/enter to edit the name.

    Alternatively, Product ==> New Scheme... to create a new one with your new name :)

    0 讨论(0)
  • 2020-11-27 10:15

    In addtion to the other answers provided if you would also like to rename the folder in which your files are placed by default (that exists at the same level as your *.xcodeproj file) then perform the below steps:

    - In Finder copy and paste the '<RootFolder>/<OldProjectName>' folder 
          (in the same location) and 
          rename the copied folder to '<RootFolder>/<NewProjectName>'
    
    - In XCode in the 'Project Navigator' (first tab in the pane on the left) 
    
    foreach ('Group' you have in your project)
    {
       Select the 'Group' and observe the details in the 'File Inspector' 
              (first tab in the pane on the right)
    
       if ('Path' == 'Relative to Group' 
              AND 'Full Path' ==  '<RootFolder>/<OldProjectName>')
       {
               Click the icon to change the path of the 'Group' 
               Choose the '<RootFolder>/<NewProjectName> folder
       }
    }
    
    - Delete the '<RootFolder>/<OldProjectName>' folder
    
    - Open the Project Settings, choose the Project target and under 'Build Settings' 
    
      - find change the path appropriately for the following values:
    
            'Prefix Header' and 'Info.plist file' 
    

    And you're done.

    If you also have a Tests folder then you will want to repeat the same.

    0 讨论(0)
提交回复
热议问题