I have a custom user property. I’m getting the value of it in the app.
When I go to the console and make a change to that value, it is updated on the console.
But when I launch the app again, the old value shows up.
Please check attached screenshots.
Thank you
Hi Mike,
Could you try reloading the console’s page to make sure the value is indeed had been saved?
Regards,
Mark
Yes, tried that.
And also Logged out logged in.
Created new user and tried again. Same issue.
Could you please show the code you use to retrieve the value?
BackendlessUser *user = [backendless.userService currentUser];
NSLog(@"User Details %@", user);
self.nameLabel.text = [user getProperty:@"addmeid_p"];
The currentUser instance in your app is not automatically updated when something changes on the server. You can retrieve the latest user object by calling the findById method on backendless.userService class. The argument would be the objectId property of your currentUser.
HI Mark,
I’m using the following methods and both of them are throwing errors. I’m sure I’m doing something wrong. Couldn’t get the right method in the documentation or github.
[backendless.userService findById:@"myColumnName" response:^(BackendlessUser *user) {
NSLog(@"User Details %@", user);
} error:^(Fault *fault) {
NSLog(@"User Details %@", fault);
}];
Fault FAULT = ‘1000’ [Entity with the specified ID cannot be found: Id - myColumnName] <Entity with the specified ID cannot be found: Id - myColumnName >
or
id<IDataStore> datastore = [backendless.persistenceService of:[BackendlessUser class]];
@try {
BackendlessCollection *collection = [datastore findID:@"myColumnName"];
NSLog(@"User Details %@", collection);
}
@catch (Fault *fault) {
NSLog(@"Fault %@", fault);
}
User Details FAULT = ‘1000’ [Entity with the specified ID cannot be found: Id - myColumnName] <Entity with the specified ID cannot be found: Id - myColumnName >
Please point me the right way. Thanks for your help.
Hey Mark,
Don’t bother, I got it working. I just wish the documentation would be better with more examples. Your answer made sense to me after figuring out the code.
Here’s the code, for anyone looking.
BackendlessUser *user = [backendless.userService currentUser];
NSString *objectID = [user getProperty:@"objectId"];
[backendless.userService findById:objectID response:^(BackendlessUser *user) {
NSLog(@"User Details %@", [user getProperty:@"myColumnName"]);
} error:^(Fault *fault) {
NSLog(@"Error retrieving user details: %@", fault);
}];