搜索后更新实体

时间:2016-09-06 19:34:05

标签: graph cosmicmind

我想更新名为type [USERS]的图表实体中的信息,其中包含以下属性: 但是在搜索后更新特定实体时,它是重复的。 谢谢

let existElement = graph.searchForEntity(properties: [(key: "username", value: username),("id", id)])


if existElement.count == 1 {

          existElement[0]["id"] = id
          existElement[0]["username"] = username
          existElement[0]["password"] = password
          existElement[0]["nome"] = nome
          existElement[0]["data_cerazione"] = NSDate()

            // salviamoIlDatabase
            graph.async() { (success: Bool, error: NSError?) in
                if let e = error { // se c'è un errore...
                    print(e.localizedDescription) // lo stampiamo in console
                }
            }
    }

0 个答案:

没有答案
相关问题