Graph icon indicating copy to clipboard operation
Graph copied to clipboard

ERROR GRAPH CANCEL ROW IN LIST

Open schulz89sp opened this issue 6 years ago • 7 comments

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

schulz89sp avatar Dec 09 '19 14:12 schulz89sp

@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?

daniel-jonathan avatar Dec 11 '19 16:12 daniel-jonathan

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

schulz89sp avatar Dec 11 '19 17:12 schulz89sp

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

OrkhanAlikhanov avatar Dec 12 '19 07:12 OrkhanAlikhanov

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!

schulz89sp avatar Dec 12 '19 13:12 schulz89sp

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

daniel-jonathan avatar Dec 12 '19 21:12 daniel-jonathan

Prova.zip

schulz89sp avatar Dec 13 '19 19:12 schulz89sp

News? seen the example?

schulz89sp avatar Jan 03 '20 18:01 schulz89sp