Backendless Support
 
Waiting for user's response

Are there special rules for autloading user relations?

I have an order object that holds a bunch of information. In particular it includes relations to a car object and a user object. I have autoload selected for both relations in backendless and the entire car object is successfully retrieved but the user object is blank.

I can see the user is related when I look in the database. The object ID is populated in the cell for object relation and when I click on it it takes me to the expected user in the user table. Is there any reason the related car object would autoload successfully but the related user doesn't? screenshots attached.

Leave a Comment

Comments (6)

photo
1

BackendlessUser class operates as a dictionary. All the retrieved properties are stored in an internal HashMap:

https://github.com/Backendless/ios-SDK/blob/master/SDK/backendlessAPI/Classes/UserService/BackendlessUser.m#L27

You will not see specific properties in the debugger because the structure would be different than of the car class.

Did you try retrieving a property from the returned object?

photo
1

Yes, when I try retrieving a property my app crashes.

I I retrieve my order object which is related to a user, then try to access a property of that user and it crashes. As I highlighted in my screenshot when I view the inspector in XCode there doesn't seem to be any data in the user object thats in the order.

After getting a the order from the database I run the following code to access my custom property and it crashes

  1. let user = order!.user!
  2. userDetails = user.getProperty("userDetails") as! UserDetails

Logs:

  1. 2017-03-12 20:37:34.149796 Yeti[584:96117] -[__NSArrayM getProperty:]: unrecognized selector sent to instance 0x170250f80
  2. 2017-03-12 20:37:34.152293 Yeti[584:96117] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM getProperty:]: unrecognized selector sent to instance 0x170250f80'
  3. *** First throw call stack:

photo
1

Thanks, Chris. We'll try it from our side. What is your app ID? Also, could you confirm you are using the latest build of the library?

photo
1

Yeah, I'm using 3.0.44 which seems to be the latest build.

App ID: 34FD2DCA-8177-1858-FFE2-6B094A7CB700

photo
photo
1

Hello, Chris

getProperty() method returns dictionary, I've checked and everything works fine (screenshot attached).

  1. let dataStore = backendless?.data.of(Order().ofClass())
  2. let orders = dataStore?.find().data as! [Order]
  3. for order in orders {
  4. let user = order.user
  5. let userDetails = user?.getProperty("userDetails")
  6. }

Could you please provide your UserDetails class code or try to use mapTableToClass method to convert the dictionary of user properties to class.

Regards

Olga

photo
1

Hello Chris,

Was the answer above helpful for you?

Is your problem solved?

Regards,

Olga