I am assigning a BackendlessUser object to [backendless.userService currentUser] and then attempting to assign all of its properties to variables. All of the properties are retrieved (including custom properties) except for the relations. All of the relations are on autoload so I cannot understand why this is happening.
This problem just began when I started remembering the user’s login instead of forcing the user to sign in each time the app is launched. What does this have to do with it? Are the relations only retrieved when the user is logged in, but not when the token is valid and the user doesn’t log in?
Thanks.
Hi Cooper,
Relations are retrieved when a user is being logged in OR if you fetch the user object with the API. If you use the ‘remember the login’ option, what’s stored on the client is the user’s objectId and user token. Using the user’s objectId, you can reload the user object with the backendless.data.of( BackendlessUser.ofClass() ).findID API.
Regards,
Mark
Thank you, Mark!
What is the purpose of the following line of code?
[userToDisplay retrieveProperties];
Also, Mark, can you please give me an example of how to use that line of code you referenced? I do not understand.
Also, must I refresh the user each time I access the user object?
Hi Cooper,
“retrieveProperties” returns a collection of values for all user properties available for the given BackendlessUser object.
I’ll have one of our iOS guys to give you a specific example for retrieving user object.
Regards,
Mark
You could investigate our sample project showing some user operations (see in attachment). Use TestUserService.xcworkspace to load it. There are two targets in this project - on objective-c and swift, so you can work with a language what you like.
TestUserService.zip (19.28MB)