Here’s my code:
Backendless.sharedInstance().userService.update(Backendless.sharedInstance().userService.currentUser, response: { (user) in
self.hideActivityIndicatorForView(self.view) {
self.performSegueWithIdentifier("MainSceneSegue", sender: nil)
}
}, error: { (fault) in
let errorDetails = fault.detail
let errorMessage = fault.message
let errorCode = fault.faultCode
if errorCode == "1000" {
// Occurs when the depended object (e.g. QuestionResult) was deleted in dashboard.
self.hideActivityIndicatorForView(self.view) {
self.performSegueWithIdentifier("MainSceneSegue", sender: nil)
}
}
else {
print2("Error updating the user: \(errorDetails)")
self.hideActivityIndicatorForView(self.view) {
self.showErrorWithErrorMessage(errorMessage, allowRetry: true, tryAgainBlock: {
self.confirmButtonPressed()
})
}
}
})
Here’s how the user object looks like:
<BackendlessUser> {
“__meta” = “{“relationRemovalIds”:{},“selectedProperties”:[“lastName”,“country”,“created”,“clinicalSpecialities”,“patientType”,“ownerId”,”__updated__meta",“score”,“firstName”,“password”,“phone”,“questionResults”,“name”,"___class",“updated”,“objectId”,“email”],“relatedObjects”:{“country”:[“F6A0B397-4E6F-88C7-FF07-E259EA987100”],“clinicalSpecialities”:[“8D14A8C4-F706-FAA0-FF94-5C3B2531E100”],“questionResults”:[“38F46D1F-FA1C-8E2A-FFD1-E5726F49C000”,“3CBACCEA-F70F-CE05-FF03-7042F314A100”,“61352EF5-E5DA-0478-FF7B-3B09B0B55700”,“74799283-7BAD-799B-FF99-C180BF143800”,“91FE156A-8ACD-6F76-FF70-820502656500”,“A7095E6A-3B3A-3806-FF3D-11E3943BFF00”,“B2669505-C18C-C5D8-FF9F-FFA4D69C9200”,“E84BF5CF-6356-AB05-FFFA-D4F2DA2E0300”]}}";
clinicalSpecialities = (
“id: 8D14A8C4-F706-FAA0-FF94-5C3B2531E100”
);
country = “id: F6A0B397-4E6F-88C7-FF07-E259EA987100”;
created = “2016-03-29 16:30:13 +0000”;
email = “aa@aa.aa”;
firstName = test;
lastLogin = “2016-04-14 06:17:37 +0000”;
lastName = test;
name = “<null>”;
objectId = “081DE1E3-A414-D224-FF7B-F72830217200”;
ownerId = “<null>”;
patientType = “id: FEBD809A-3BD5-415F-FFC8-26E8666CCE00”;
phone = “<null>”;
questionResults = (
“id: 38F46D1F-FA1C-8E2A-FFD1-E5726F49C000”,
“id: 3CBACCEA-F70F-CE05-FF03-7042F314A100”,
“id: 61352EF5-E5DA-0478-FF7B-3B09B0B55700”,
“id: 74799283-7BAD-799B-FF99-C180BF143800”,
“id: 91FE156A-8ACD-6F76-FF70-820502656500”,
“id: A7095E6A-3B3A-3806-FF3D-11E3943BFF00”,
“id: B2669505-C18C-C5D8-FF9F-FFA4D69C9200”,
“id: E84BF5CF-6356-AB05-FFFA-D4F2DA2E0300”
);
score = 40;
updated = “2016-04-14 06:15:26 +0000”;
“user-token” = “390CF141-EA91-B1F5-FFAE-6BAF134AE600”;
}