Rename xcdatamodel file

前端 未结 10 2139
暖寄归人
暖寄归人 2020-12-05 00:55

What do in need to do to rename the .xcdatamodel file. Renaming .xcdatamodel filename, along with changing ...

NSURL *modelURL = [[NSBundle mainBundle] URLFo         


        
10条回答
  •  伪装坚强ぢ
    2020-12-05 01:19

    I have been having the same problem with Xcode 4. Don't know what the behaviour is in Xcode 3.

    Firstly, when you add a core data model in xcode, you actually get a .xcdatamodeld file which is a package like the .xcodeproj file. In finder, you can right click it and "Show Package Contents". You'll see it contains a .xcdatamodel file.

    It seems to me you can't rename it fully using xcode. Xcode will change the name of the package file (the momd) as you see it in the UI, but on the file system it has not actually changed.

    The nil model error you get is because it can't find the newfilename momd since it still has the old name on disk. (I guess)

    I worked around this by creating a new model with the name I wanted, then in the existing model, you can click-drag and select your entities, then just paste them into the new model file. You can then delete the old one and commit all the changes to your SCM.

提交回复
热议问题