0

I have some custom fields in my _User class on parse and I would like to subclass it in order to implement some convenience methods such as getName(), getSurname() and so on... usually i have no problems when subclassing ParseObjects, but with ParseUser I get a ClassCastException when obtaining the current user. Here is what I have done:

@ParseClassName("_User")
public class ParseStudent extends ParseUser { ... }

Then I subscribed the new class in my Application class

ParseObject.registerSubclass(ParseStudent.class);

When I try to access the current user as an instance of my subclass in this way

ParseStudent user = (ParseStudent) ParseUser.getCurrentUser();

I get the exception. Any ideas on what could be wrong?

1 Answer 1

1

The problem was in the custom subclass subscribing, which I performed after parse initialization. It must be done before it, as stated in the docs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.