-
Notifications
You must be signed in to change notification settings - Fork 27
Updating core data object causes DATASource to delete from tableView #122
Comments
Hola @ortizroberto, I can't understand why that would be happening, is there any chance you could try to isolate this problem into any of the demos included in this project? If this an offline app? Or do you do some syncing? |
Hi @3lvis, I'll try to isolate the problem like you're suggesting, I already saw by using Core Data Editor (an app that lets you explore SQLite) that in fact the object is being updated and not deleted. The app does some syncing, but in this part specifically I make a request and depending on the response I do the update. |
@ortizroberto I imagined that the issue might be the update, probably the groupId gets updated for some reason and the item disappears from the list. |
After days I finally found the problem. For some reason the argument in the predicate must be provided in the same type as you have it on your Model. request.predicate = NSPredicate(format: "group.groupId == %@", group) with request.predicate = NSPredicate(format: "group.groupId == %@", NSNumber(value:(group as NSString).floatValue)) and now everything is working as it should 😁. thanks for the support @3lvis . |
I'm glad you got it working. Take care! |
I am setting up a
UITableView
withDATASource
like this:But after I update an object with the code below it gets deleted, even
func dataSource(_ dataSource: DATASource, didDeleteObject object: NSManagedObject, atIndexPath indexPath: IndexPath)
gets calledI have been hesitant to submit an issue but I can't see where the problem is.
The text was updated successfully, but these errors were encountered: