CosmicMind / Graph

Graph is a semantic database that is used to create data-driven applications.
http://cosmicmind.com
MIT License
873 stars 72 forks source link

ERROR GRAPH CANCEL ROW IN LIST #164

Open schulz89sp opened 4 years ago

schulz89sp commented 4 years ago
func cancella(at offset: IndexSet) {
        guard let intindex = Array(offset).first else { return }
        let id = dm.Storage[intindex].properties["id"] as? String ?? ""
        DataManager.Shared.cancellaPosto(id)
    }

func cancellaPosto(_ ID: String) {
        let operazioneSearch = Search<Entity>(graph: DB).where(.type("Posti") && "id" == ID)
        let operazione =  operazioneSearch.sync(completion: nil)

        if let opeDaCanc = operazione.first {
            opeDaCanc.delete()
            if let index = Storage.firstIndex(of: opeDaCanc) {
                self.Storage.remove(at: index)
                self.objectWillChange.send()
            }
        }

        DB.async {(Bool, error) in
            if let e = error {
                print(e.localizedDescription)
            }
        }
    }

Fatal error: [Graph Error: Cannot obtain permanent objectID]: file /Users/schulz/Desktop/POI MapNote/POI MapNote/Graph/ManagedNode.swift, line 40 2019-12-09 15:53:14.847221+0100 Simple List[48128:2685330] Fatal error: [Graph Error: Cannot obtain permanent objectID]: file /Users/schulz/Desktop/POI MapNote/POI MapNote/Graph/ManagedNode.swift, line 40

daniel-jonathan commented 4 years ago

@schulz89sp when did this error occur, what has changed since before this error? What device are you using to test this, and what is your Graph version and OS?

schulz89sp commented 4 years ago

Using the latest version of xCode and the latest version of Graph, to try using the simulator, however, to program swiftUI use...

OrkhanAlikhanov commented 4 years ago

It's hard to guess what went wrong. Can you please provide a minimal sample that reproduces the issue?

schulz89sp commented 4 years ago

If you create any entity with 2 properties: id and title both strings then in the swiftUI controller create a list that has all the titles inside it and try to delete one at random by passing the ID as the value of the selected cell obtained the error... If you want to give me an email I send you an example!

daniel-jonathan commented 4 years ago

@schulz89sp Hi, we want to help you, but to save time, please provide a sample that demonstrates the issue. Thank you!

schulz89sp commented 4 years ago

Prova.zip

schulz89sp commented 4 years ago

News? seen the example?