Undo “New group from selection” project xcode 4

2019-03-17 03:35发布

I accidentally added my project to a group, and now I can't remove it from it in xcode 4, any ideas? If I drag it out, it asks me to create a workspace...

The problem

EDIT: I reported this to apple in the bug reporter, I'll keep you guys updated

3条回答
ら.Afraid
2楼-- · 2019-03-17 04:14

or you can just manually edit the contents.xcworkspacedata file to do this:

  1. close xcode
  2. right click on your project's .xcodeproj, then click "Show Package Contents"
  3. inside .xcodeproj, right click on project.xcworkspace, then click "Show Package Contents"
  4. inside project.xcworkspace, open contents.xcworkspacedata with a text editor. remove the < Group > section from the xml and just leave the < FileRef > section intact like so:

    From :

    <?xml version="1.0" encoding="UTF-8"?>
    <Workspace
       version = "1.0">
       <Group
          location = "container:"
          name = "New Group">
          <FileRef
             location = "self:ProjectName.xcodeproj">
          </FileRef>
       </Group>
    </Workspace>
    

    Into:

    <?xml version="1.0" encoding="UTF-8"?>
    <Workspace
       version = "1.0">
       <FileRef
          location = "self:ProjectName.xcodeproj">
       </FileRef>
    </Workspace>
    
  5. save it and re-open your xcode project and it would be back to normal.

查看更多
趁早两清
3楼-- · 2019-03-17 04:14

You should be able to drag it out to be a top-level item in the sidebar, but you have to be very careful where you release the mouse while dragging it out -- the horizontal position where you release it determines where it ends up. If that doesn't work, you may want to file a bug

查看更多
beautiful°
4楼-- · 2019-03-17 04:18

This is a project without a workspace?

Close Xcode. Back up the .xcodeproj, then right click the original and Show Package Contents. Inisde, you'll see a file called project.xcworkspace. This is a workspace created by Xcode when a project is open without a xcworkspace, and it contains this grouping information.

Move this to the trash and reopen the project in Xcode; it will generate a new, default project.xcworkspace without the grouping.

查看更多
登录 后发表回答