somtimes syncAddObject not working
dlpigpen opened this issue · comments
Sometimes this function works fine but sometimes there is no update to database.
Hello!
Could you please provide some more information regarding the issue (such as stack trace or example code)? It would make it much easier to identify the problem :)
What does the method return? Does it say that the update was successful?
I don't know how to say for you easily fix it but basically I created an object, updated a value of an integer variable. Sometimes the value is updated, but sometimes there is no thing. I have to use the method: database.addObject(template, update: true), it works fine then.
Thanks for the response :)
Ok. If an object with the same primary key already exists, you have to use update = true
, or you will get a constraint violation error from SQLite. I believe true
is the default value, so I'll have a look at it.