1
我找不到我的代碼有什麼問題。我試圖用Swift使用MagicalRecord。當我做一些簡單的createEntity它給了我零:魔法記錄 - MR_createEntity返回無
let a = Subject.MR_createEntity() <--- This line is working perfectly
let b = Points.MR_createEntity() <--- This line returns nil
let c = Class.MR_createEntity() <--- This line returns nil
這是我的類實現:
主題:
@objc(Subject)
class Subject: NSManagedObject {
@NSManaged var name: String?
@NSManaged var classes: NSSet?
}
類:
@objc(Class)
class Class: NSManagedObject {
@NSManaged var name: String?
@NSManaged var teacherName: String?
@NSManaged var subject: Subject?
@NSManaged var points: NSSet?
}
點:
@objc(Points)
class Points: NSManagedObject {
@NSManaged var date: NSDate?
@NSManaged var points: NSNumber?
@NSManaged var maxPoints: NSNumber?
@NSManaged var classType: Class?
}