简体   繁体   English

Xcode 6:编译NSManagedObject类时出现属性错误

[英]Xcode 6: attribute error when compiling a NSManagedObject class

In my coreData model I have defined an entity MyEnity with several attributes. 在我的coreData模型中,我定义了具有多个属性的实体MyEnity Among them two attibutes : 其中两个服装:

mute : Boolean 
deleted : Boolean

I have a NSManagedObject class associated with MyEntity . 我有一个与MyEntity关联的NSManagedObject类。 In this class I have : 在本课程中,我有:

@NSManaged var mute: NSNumber
@NSManaged var deleted: NSNumber // compilation error

But the second line produces an error and can't be compiled. 但是第二行会产生错误,无法编译。 This is the error I get : 这是我得到的错误:

Property 'deleted' with type 'NSNumber' cannot override a property with type 'Bool' 类型为“ NSNumber”的属性“已删除”不能覆盖类型为“布尔”的属性

I don't understand what is the issue and why I don't have the same issue for the mute attribute ? 我不明白这是什么问题,为什么对mute属性没有相同的问题?

NSManagedObject有一个名为deleteed的属性,如下所示因此在您的情况下使用不适当的类型(NSNumber代替Bool)使用删除的变量名将覆盖该属性,这会导致编译时错误

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

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