How to delete an old/unused Data Model Version in Xcode

后端 未结 4 1329
情话喂你
情话喂你 2020-11-29 16:00

How can I delete an old Data Model in Xcode? The option is disabled on the menu. (The models I want to delete have not been released to the public - they are interim develop

4条回答
  •  暖寄归人
    2020-11-29 16:19

    This worked for me in XCode 10.3 without the ordering issue occurring when removing the whole model and adding it again:

    1. Select any model version other than the one you want to delete.
    2. From XCode, right-click the .xcdatamodeld file and select 'Show in Finder'.
    3. Close XCode.
    4. In finder, right-click the same file and select 'Show Package Contents'.
    5. Write down the name of the model you want to remove, then from Finder, delete it.
    6. Still in Finder, navigate to the project file (.xcodeproj).
    7. Right-click and open with Atom or any other editor.
    8. From the 'Project' pane open project.pbxproj file.
    9. Remove all lines containing the model name you removed (Example: "ABC 17.xcdatamodel"). You will find two lines similar to the following:

      9D88880323C545B800A789B9 /* ABC 17.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "ABC 17.xcdatamodel"; sourceTree = ""; };

      9D88880323C545B800A789B9 /* ABC 17.xcdatamodel */,

      Note if you find a third line it will be something like:

      currentVersion = 9D88880323C545B800A789B9 /* ABC 17.xcdatamodel */;

      That means it is the currently selected model. Never delete this line. Just change the text to another model version.

    10. Re-open XCode.

提交回复
热议问题