我正在尝试将我的api数据存储在核心数据实体中。我也有一些自定义数据类型数组。因此,我使这些属性可转换。像这样,
现在,当我创建实体的NSManagedObject
类时,它向我显示错误
@NSManaged属性不能具有初始值。
我的SingleChat+CoreDataProperties.swift
班是这个,
extension SingleChat {
@nonobjc public class func fetchRequest() -> NSFetchRequest<SingleChat> {
return NSFetchRequest<SingleChat>(entityName: "SingleChat")
}
@NSManaged public var name: String?
@NSManaged public var roomSID: String?
@NSManaged public var isGroup: Bool
@NSManaged public var lastMessage: String?
@NSManaged public var lastMsgTime: String?
@NSManaged public var lastMsgTimeActual: String?
@NSManaged public var profilePic: String?
@NSManaged public var lastMsgRead: Bool
@NSManaged public var unReadMsgsCount: Int16
@NSManaged public var actualNameFor_1_2_1_chat: String?
@NSManaged public var isNewGroup: Bool
@NSManaged public var members = [TCHMember]()
@NSManaged public var messages = [TCHMessage]()
@NSManaged public var twChannelObj: TCHChannel?
@NSManaged public var group_info: [String:JSON]?
}
我是核心数据的新手,不知道如何获取自定义数据类型。我如何解决此问题,我想将数据存储在成员,消息和group_info中。这些是数组。