Start a new topic
Answered

User Query iOS version 3.0

I have a custom field in the User Class labeled "groupId". I would like to query the User Class for all users with a certain groupId. Can you share the special syntax that is required to query custom fields within the User class?


Best Answer
Matt,

You are talking about custom user class. Datastore queries will work in the same way for regular and custom user class. Adding a custom type also requires that you downcast any User objects returned by the library to your CustomUser type, in order to use the properties of the custom type.

Following is the code which is used for downcasting of user object:

if let user = user as? CustomUser


Please check http://devcenter.kinvey.com/ios/guides/users#UserClass for better understanding of custom user.


Thanks,
Pranav
Kinvey

Answer
Matt,

You are talking about custom user class. Datastore queries will work in the same way for regular and custom user class. Adding a custom type also requires that you downcast any User objects returned by the library to your CustomUser type, in order to use the properties of the custom type.

Following is the code which is used for downcasting of user object:

if let user = user as? CustomUser


Please check http://devcenter.kinvey.com/ios/guides/users#UserClass for better understanding of custom user.


Thanks,
Pranav
Kinvey

To be clear, I'm talking about Kinvey's special User Class. The link above appears to link to the standard datastore querying. Do you have a sample code snippet of query on Kinvey's User Class so that I can see how that syntax is structured in the new version 3.0?

Matt,

Please take a look at http://devcenter.kinvey.com/ios/guides/datastore#Querying.

Thanks,
Pranav
Kinvey

 

Login or Signup to post a comment