Hi team
Not sure what Im doing wrong here…
I have a table that has a unique relationship with the User table.
I am trying to update a Bool field on the table,
func publicSwitchValueChanged(publicSwitch: UISwitch) {
print("Switch changed - \(publicSwitch.on)")
self.pinnedListObject?.listIsPublic = publicSwitch.on
BackendlessCalls.sharedInstance.updatePinnedListStatus(pinnedListObject!) { (success, pinnedList) in
if success {
print(">>>>>> PinnedListStatus updated successfully")
} else {
print(">>>>>> PinnedListStatus failed to update")
}
}
}
Which then calls the below… (With the updated ‘listIsPublic’ field)
func updatePinnedListStatus(pinnedList: PinnedList, completionHandler: (success: Bool, pinnedList: PinnedList?) -> ()) {
print("**** BackendlessCalls - updatePinnedListStatus...")
let dataStore = Backendless.sharedInstance().data.of(PinnedList.ofClass())
dataStore.save(
pinnedList,
response: { (result: AnyObject!) -> Void in
let updatedPinnedList = result as! PinnedList
print("PinnedList has been updated: \(updatedPinnedList.objectId)")
},
error: { (fault: Fault!) -> Void in
print("Server reported an error (2): \(fault)")
})
}
but getting the reported error
Server reported an error (2): FAULT = '1166' [Duplicate entry for column 'user'] <Duplicate entry for column 'user'>
Im not making any changes to the ‘user’ field, and am purely just wanting to update the one property of the associated ‘PinnedList’ object.
Not sure where the error is coming from…
any insight would be greatly appreciated, thanks!
App ID = 29100CD0-A42D-0188-FFEC-947AB5CA5900