User properties coming up as nil

Hey guys, I have a user who has a product they have ‘favorited.’ The user has a field called favoritedProducts which contains a string ID in Backendless.

However, when I run this code, string is never printed and the value is nil, when it should have a value. Any help would be much appreciated.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}
span.s1 {font-variant-ligatures: no-common-ligatures}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #bb2ca2}
span.s3 {font-variant-ligatures: no-common-ligatures; color: #d12f1b}
span.s4 {font-variant-ligatures: no-common-ligatures; color: #703daa}

if let string = backendless?.userService.currentUser!.getProperty(“favoritedProducts”) as? String {

        print("The string is \(string)")

    }

Hi Rich,

Did you check in the debugger if the “currentUser” object has any other values?

Mark

Yes, the currentUser has other values.

Check the spelling of “favoritedProducts” with the name of the column in Backendless console.

The spellings match. We just checked.

We just created a new column called “favoriteProducts” but that is just for testing.

Try creating a separate project where you load the user object by objectId and see if it has the value.