Skip to content

Update must run save() two times  #317

@zaneLou

Description

@zaneLou

What

jsonEntity is NSManagedObject, when i got it from database, update some property.
if i commet try (self.db.mainContext as? NSManagedObjectContext)?.save(), database is not updated, when i restart my app, jsonEntity's property is not updated. i need run two save()
slove the problem.

Context

        do {
            jsonEntity?.content = self._gameProfileModel?.toJSONString()
            try db.operation ({ (context, save) throws in
                try (self.db.mainContext as? NSManagedObjectContext)?.save()
                save()
            })
        }
        catch {
            print("updateGameProfileModel error \(error)")
        }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions