Start a new topic

Subclassing KCSUser

Is it good practice to subclass the KCSUser? And if you can, why can you not access custom attributes by using dot notation?

Could you guys put an example of this in the docs?

Im sure a lot of us coming from parse subclasses PFUser and would like to do similar during the migration.


1 person likes this
In general it's not recommended. You can use the get/setAttribute methods to add additional properties to a user, if you just want to customize it. However, if you will have to subclass to add automatic references to it. When you subclass KCSUser, be sure to call the super `hostToKinveyPropertyMapping` and then add any new fields to that dictionary. Also you have to set the `KCS_USER_CLASS` option in your kcsclientconfiguration, ex



KCSClientConfiguration* config = [KCSClientConfiguration configurationWithAppKey:@"KEY" secret:@"SECRET" options:@{KCS_USER_CLASS:[YourSubclass class]}];

Hi Mike, I am sorry to hear that it is not recommended, In my use case, the User class is very built out . Is there any reason behind it not being recommended? Performance issues etc? I am very fond of the way the Parse platform allows you to subclass the user class... But I am judging by your response you do not support a similar system.
I am not familiar with their user class system. We don't recommend it only because of all things you have to get right, such as overriding the property mapping and setting the class in the configuration. If done correctly, you will be able to use your custom subclass.
Login or Signup to post a comment