我收到了错误
尝试访问此属性时明确声明getter'-newRelationship' '属性((objc_method_family(none)))'返回'无主' 对象
@property (nonatomic, strong) NSString* newBornTypeRawValue;
在子类的扩展中。我正在使用coreData和mogenerator。 superClass是用mogenerator生成的,然后在子类的swift扩展中我有以下代码
extension SubClassName {
var newBornType: DifferentType? {
get {
willAccessValue(forKey: "newBornTypeRawValue")
let storedStringOP = primitiveNewBornTypeRawValue()
didAccessValue(forKey: "newBornTypeRawValue")
if let storedString = storedStringOP {
return DifferentType(storedString)
} else {
return nil
}
}
set {
guard let newValue = newValue else {
willAccessValue(forKey: "newBornTypeRawValue")
setPrimitiveNewBornTypeRawValue(nil)
self.didAccessValue(forKey: "newBornTypeRawValue")
return
}
let rawValue = newValue.rawValue //This returns a String
willAccessValue(forKey: "newBornTypeRawValue")
setPrimitiveNewBornTypeRawValue(rawValue)
didAccessValue(forKey: "newBornTypeRawValue")
}
}
}