Backendless Support
 
Cannot Reproduce

User.getProperty Not Returning Most Recent Value, Want to Force a Server Lookup

Hi, I am trying to access a user property, which is working but it fails to retrieve the most recent updated value. I changed one of my user properties to false in the Backendless server side and yet in my iOS application, it still shows true. I looked through the documentation and I think this may have to do with the local persistent storage and it using the local storage when the user logs in rather than the server value. Is there any way to force a server lookup to get the most recent value anytime I use get property? Thanks. Currently my code looks like this:

let user = self.backendless?.userService.currentUser

print("***test: ",user?.getProperty("Offline") as! Bool)

And to test this, I changed the property of Offline after the user is logged in and it failed to reflect that within getProperty.

Leave a Comment

Comments (13)

photo
1

Hello Patrick James White,

What version of Backendless do you use: 3 or 4?

Also, please provide us with your APP ID so we can check this issue.

Regards, Olga

photo
1

Thanks Olga for the reply.

I'm using version 3, should I switch over to 4?

And my app id is 18D2E9DE-A7E7-CA88-FF1A-6F9A2AC87D00.

I found that it reflects the most recent changes when I update properties within the app, but it is not updated when I change it in the Backendless Data Browser. Thanks.

photo
1

Ok, we'll check and response you as soon as possible.

Regards, Olga

photo
1

I've tried to reproduce your issue, but everything works fine for me:

  1. let dataStore = backendless.data.ofTable("Users")
  2. let user = dataStore?.find(byId: "XXX")
  3. print("User = \(user?["Offline"] as! Bool)")

or

  1. backendless.userService.login("XXX@XXX.com", password: "XXX")
  2. backendless.userService.setStayLoggedIn(true)
  3. let user : BackendlessUser = self.backendless.userService.currentUser
  4. print("User = \(user.getProperty("Offline") as! Bool!)")

when added email and password for the user.

Regards, Olga

photo
1

Hey Olga I can't seem to find my app in my console to test the issue? Are you still using it to debug?

Thanks. Pat

photo
1

Hi Patrick,

I could not locate your app in the system either. I assume you didn't request it to be deleted, did you? I will request our SysOps to restore the app.

Regards,

Mark

photo
1

Hey Mark thanks for the reply. I didn't request for it to be deleted, I do have a copy on the 4.0 console though, but it would be helpful to get the 3.0 version so I can port the most reason version of my app to the 4.0 version. Thanks.

Pat

photo
1

Hi Pat,

We have restored the app in the 3.x environment.

Regards,

Mark

photo
1

Hey Mark,

When I try to deploy my business logic from the 3.x environment, I am not getting indication that the two timers are executing even when I force it to run, by clicking run now. It was running before and I have checked the start dates and they are ahead of when I deploy the app. I have a simple log statement after the execute and it is being called under debug mode, but not in production mode. I also haven't changed any of the javascript I wrote prior to the 3.x environment being deleted. Let me know if I should create a new topic for this, but I think it might be related. Thanks and have a good day.

Pat

photo
1

Hey Pat,

I checked the log and I see the following, which tells me the timers are running:

2017-04-17 22:58:30,207 | MyLogger | INFO | started timer stats

2017-04-17 22:59:00,507 | MyLogger | INFO | started timer

2017-04-17 22:59:01,023 | MyLogger | INFO | inside find

2017-04-17 22:59:01,023 | MyLogger | INFO | inside map

2017-04-17 22:59:01,023 | MyLogger | INFO | inside map

2017-04-17 22:59:01,023 | MyLogger | INFO | inside map

2017-04-17 22:59:30,204 | MyLogger | INFO | started timer stats

2017-04-17 23:00:00,515 | MyLogger | INFO | started timer

2017-04-17 23:00:00,684 | MyLogger | INFO | inside find

2017-04-17 23:00:00,684 | MyLogger | INFO | inside map

2017-04-17 23:00:00,684 | MyLogger | INFO | inside map

2017-04-17 23:00:00,684 | MyLogger | INFO | inside map

What do you think?

Mark

photo
1

I checked that too and the output you posted is only from I ran it in debug mode. When I deploy it to production, there is no output given. A week ago I would get constant output every minute from production mode (I scheduled it run every minute). The logs you are seeing are solely when I run it within debug mode. I scheduled the production mode to run from Mon Apr 17 23:24:00 and as you can see there is no output past that given time.

For sanity sake, I have attached screenshots and the current log statement. As you can see under the log statement, the output is correlated to the debug start time. But when I run it under production, there is no such output even though I scheduled it to run at Tue Apr 18 03:20:30. Thanks for any help.

2017-04-18 03:17:00,580 | MyLogger | INFO | started timer stats

2017-04-18 03:17:30,292 | MyLogger | INFO | started timer

2017-04-18 03:17:30,520 | MyLogger | INFO | inside find

2017-04-18 03:17:30,520 | MyLogger | INFO | inside map

2017-04-18 03:17:30,520 | MyLogger | INFO | inside map

2017-04-18 03:17:30,520 | MyLogger | INFO | inside map

Pat

photo
1

Pat,

I assigned it to a developer to investigate.

Regards,

Mark

photo
1

Thanks Mark, appreciate it.

photo