首页 > 解决方案 > CoreStore错误swift4未声明类型

问题描述

我正在尝试使用 CoreStore 创建对象并在其中插入此数据,但它给了我一个错误

let dataStack: DataStack = {
        let dataStack = DataStack(xcodeModelName: "ModelName")
        do {
            try dataStack.addStorageAndWait(SQLiteStore(fileURL: fileURL, configuration: "Default", localStorageOptions: .
                recreateStoreOnModelMismatch))
        } catch let error {
            print("Cannot set up database storage: \(error)")
        }
        return dataStack
    }()
    dataStack.perform(
        asynchronous: { (transaction) -> Void in
            let user = transaction.create(Into<Heroes>()) // undeclared type "Heros"
            user.time = self.timest
            user.token = self.qrrec
            user.type = "QR"
            user.midass = self.midaaas
    }, completion: {  (result) -> Void in
        switch result {
        case .success: print("success!")
        case .failure(let error): print(error)
        }
    })

发生错误让 user = transaction.create(Into()) 未声明类型“英雄”

有什么建议吗?

谢谢

标签: swift

解决方案


推荐阅读