简体   繁体   English

XCode4 无法正确生成 NSManagedObject 子类

[英]XCode4 fails to generate NSManagedObject subclass properly

I created a model using the model Editor in XCode4.我使用 XCode4 中的 model 编辑器创建了 model。 After a short while I decided to rename my entities.过了一会儿,我决定重命名我的实体。

That worked well but when I try to generate a NSManagedObject sublass from them, XCode generate them with the old entity/class name.效果很好,但是当我尝试从它们生成 NSManagedObject 子类时,XCode 使用旧实体/类名生成它们。

Is this a known bug?这是一个已知的错误?

I solved it.我解决了。 This isn't a bug.这不是错误。 If you click on the Entity you have to change the class name in the inspector, too.如果您单击实体,您也必须在检查器中更改 class 名称。

Yes, this is a bug.是的,这是一个错误。 I don't know if it has been reported yet, though.不过不知道有没有被举报。 If not it should be.如果不是,它应该是。 I have had the same problem.我曾经也有过一样的问题。 My solution, unfortunately, was to create a new model from scratch.不幸的是,我的解决方案是从头开始创建一个新的 model。 Alternatively, you could try to modify the elements file in your.xcdatamodel file.或者,您可以尝试修改您的 .xcdatamodel 文件中的元素文件。 However, this file is a proprietary format and is not guaranteed to work.但是,此文件是专有格式,不保证可以正常工作。 You may create a bigger problem by trying to edit it.您可能会通过尝试对其进行编辑来制造更大的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM