let friendship = Friendship(members: [currentUser, selectedUser])
which used my custom init:
init(members: [BackendlessUser]) {
self.members = members
super.init()
}
and then saving it like so:
backendless.persistenceService.of(Friendship.ofClass()).save(self, response: { (savedFriendship) -> Void in
print("successfully saved friendship")
completed(fault: nil)
}) { (fault) -> Void in
print("Server reported an error: \(fault)")
completed(fault: fault)
}
But at times I get back:
Server reported an error: Server reported an error: FAULT = '8011' [Users can only be added as related objects by specifying their valid object ID, all other values are ignored. For creating Users please use User API.] ULT = '8011' [Users can only be added as related objects by specifying their valid object ID, all other values are ignored. For creating Users please use User API.]
The only way I’m creating users is through registering users with the User API so I don’t believe that is the case. It’s odd because sometimes I get he fault; sometimes I dint
currentUser is retrieved by querying for a specific User via an objectId (which I get from backendless.userService().currentUser).
The reason I have to get currentUser by this query (as opposed to just using userService.currentUser) is otherwise the relatedProperties on it are empty.
I see, thanks, Vik. I assume you recently updated the library from the github repo. To rule out any regression in it, may I ask you to download the library from our website (instead of git) and see if that use-case works with that version?
It works when the currentUser has no data in its friends property (which a relation to many other Users). But then when the currentUser has values on that property it gives me that error.
I see there are three users: “tom”, “chris” and “vik”. In the first screenshot “friendship” is between “tom” and “chris”. In the last one “chris” is in the “friends” list of “tom”.
Could you describe what combination of members in a Friendship and their corresponding friends causes the error?
for error 8011 that is “Users can be added as related objects…”. I am trying with users with valid object id and also users are created using User API.