CoreData类的重新声明无效 [英] Invalid redeclaration on CoreData classes

查看:135
本文介绍了CoreData类的重新声明无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CoreData,在一个名为RoleName的实体上。



问题是:我在我的模型中单击Create NSManagedObject subclass,所以它会自动为我的实体创建类。



但是,在类的声明中,我收到此错误:


无效重新声明RoleName


即使我没有任何其他课程具有相同的名称。

解决方案

这是因为Xcode自己处理所有这些。我觉得这有点麻烦,因为自动生成的类没有我的所有属性。



所以按照以下步骤来实现: / p>


  • 删除你已经为核心数据制作过的类。

  • 设置class.Module作为当前产品模块


  • 将Class.codegen设置为手动/无







  • 现在选择您的实体并创建NSmanagedobject子类


  • 您已完成设置



I am working with CoreData, on an entity called "RoleName".

The problem is: I click on "Create NSManagedObject subclass" from within my model, and so it automatically creates the classes for my entity.

However, on the declaration of the class, I get this error:

Invalid redeclaration of "RoleName"

even though I don't have any other class with the same name.

解决方案

This is because Xcode handles all that by itself. I felt it like a bit of trouble as the auto generated classes don't have all my properties.

So follow these steps to get this as it used to be:

  • Delete what ever classes you already made for core data.
  • Set class.Module as Current Product module

  • Set Class.codegen as Manual/None

  • Now select your entity and create NSmanagedobject subclass

  • You are all set

这篇关于CoreData类的重新声明无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆