Parse error : Must specify a ParseObject class name

ThijsM

I have a problem when I want to retrieve ParseObjects from subclass containing a ParseRelation

When this code runs:

public void loadProjectsForCurrentUser() {
    User currUser = UserManager.Instance.CurrentUser;
    if (currUser != null) {
        currUser.Projects.Query.FindAsync().ContinueWith(t => {
            if(onProjectsLoaded != null) {
                onProjectsLoaded(new List<Project>(t.Result));
            }
        });
    } else {
        Debug.LogWarning("Trying to load projects while not logged in!");
    }
}

I get this error:

Error Message : Must specify a ParseObject class name when creating a ParseQuery. Parameter name: className

This is a part of my subclass:

[ParseFieldName(PARSE_VALUES.Projects)]
[CoherentProperty]
public ParseRelation<Project> Projects {
    get { return GetRelationProperty<Project>("Projects"); }
}

When the user logs in, I create a new instance of User, and I fetch the data like this:

User currUser = ParseUser.CreateWithoutData<User>(ParseUser.CurrentUser.ObjectId);
currUser.FetchIfNeededAsync().ContinueWith(userResult => {
  Debug.Log("Fetched User");
  currUser.Company.FetchIfNeededAsync().ContinueWith(companyResult => {
    Debug.Log("Fetched Company");
    UserManager.Instance.CurrentUser = currUser;
    ParentView.TriggerEvent("login", UserManager.Instance.CurrentUser);
    ProjectManager.Instance.loadProjectsForCurrentUser();
    if (onLogin != null)
        onLogin();
  });
});

I already found this page: https://www.parse.com/questions/error-when-querying-relational-data-in-unity

Here is the stack trace, might contain interesting information:

Error Message: Must specify a ParseObject class name when creating a ParseQuery. Parameter name: className Stack Trace: at Parse.ParseQuery1<Project>..ctor (string) <0x0008f> at Parse.ParseRelationBase.GetQuery<Project> () <0x0004e> at Parse.ParseRelation1.get_Query () <0x00039> at (wrapper dynamic-method) Parse.ParseRelation1<Project>.GetProperty (Parse.ParseRelation1&,Coherent.UI.Binding.Exporter) at Coherent.UI.Binding.UserDefinedTypeExporter1<Parse.ParseRelation1>.Export (Coherent.UI.Binding.Exporter,Parse.ParseRelation1<Project>) <0x00145> at Coherent.UI.Binding.Exporter.Export<Parse.ParseRelation1> (Parse.ParseRelation1<Project>) <0x00404> at (wrapper dynamic-method) User.GetProperty (User&,Coherent.UI.Binding.Exporter) <IL 0x00008, 0x00048> at Coherent.UI.Binding.UserDefinedTypeExporter1.Export (Coherent.UI.Binding.Exporter,User) <0x00145> at Coherent.UI.Binding.Exporter.Export (User) <0x00404> at (wrapper dynamic-method) Project.GetProperty (Project&,Coherent.UI.Binding.Exporter) at Coherent.UI.Binding.UserDefinedTypeExporter1<Project>.Export (Coherent.UI.Binding.Exporter,Project) <0x00145> at Coherent.UI.Binding.Exporter.Export<Project> (Project) <0x00404> at Coherent.UI.Binding.Exporter.ExportIList<Project> (Coherent.UI.Binding.Exporter,System.Collections.Generic.IList1) <0x00142> at (wrapper dynamic-method) Coherent.UI.Binding.Exporter.Exporter (Coherent.UI.Binding.Exporter,System.Collections.Generic.List1<Project>) <IL 0x00002, 0x0002c> at Coherent.UI.Binding.Exporter.Export<System.Collections.Generic.List1> (System.Collections.Generic.List1<Project>) <0x00404> at Coherent.UI.Binding.ViewExtensions.TriggerEvent<System.Collections.Generic.List1> (Coherent.UI.View,string,System.Collections.Generic.List1<Project>) <0x00073> at ProjectsWidget.onProjectsLoaded (System.Collections.Generic.List1) [0x0000c] in

But I can't seem to find the error... Anyone that can help?

ThijsM

Found it myself eventually.

It is a combination of problems between Coherent and Parse. Coherent tries to use the default constructor of ParseRelation, which I use in the User class as a property. But ParseRelation doesn't have a default constructor.

Coherent does expect a default constructor. I changed the following:

[ParseFieldName(PARSE_VALUES.Projects)]
[CoherentProperty]
public ParseRelation<Project> Projects {
    get { return GetRelationProperty<Project>("Projects"); }
}

into

[ParseFieldName(PARSE_VALUES.Projects)]
public ParseRelation<Project> Projects {
    get { return GetRelationProperty<Project>("Projects"); }
}

By removing the CoherentProperty tag, which I eventually don't need here, Coherent doesn't want to export ParseRelation, therefore I don't have the constructor error anymore!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

"How to fix 'Error: must either provide a name or specify --generate-name' in Helm"

From Dev

Must I specify the parent activity name in the Android Manifest?

From Dev

Android error: Path requests must specify a user by using UserEnvironment

From Dev

error: name followed by '::' must be a class or namespace name

From Dev

Class library with Parse throws error

From Dev

ERROR: Need to specify class name in environment or system property LDAP and JNDI

From Dev

fatal error class name must be a valid object or a string

From Dev

SetReadAccess error for new ParseObject

From Dev

Wildfly Maven Plugin error: deploy-artifact must specify the artifactId

From Dev

You must register this ParseObject subclass before instantiating it

From Dev

Merge r brings error "'by' must specify uniquely valid columns"

From Dev

Class cannot be cast to ParseObject

From Dev

Error: Must specify a primary resource (JAR or Python file) - Spark scala

From Dev

Java - Parse - iterate over ParseObject fields

From Dev

Error: JSON Parse error: Property name must be a string literal when using angular translate

From Dev

Parse Query not registering class name

From Dev

configure: error: cannot guess build type; you must specify one

From Dev

ERROR: unbound method "method name" must be called with "Class Name" instance as first argument (got classobj instance instead)

From Dev

ERROR: Need to specify class name in environment or system property LDAP and JNDI

From Dev

ERROR: Function name must be a string

From Dev

fatal error class name must be a valid object or a string

From Dev

Class cannot be cast to ParseObject

From Dev

configure: error: cannot guess build type; you must specify one

From Dev

Encounter code 106 error, when parse class column name is changed

From Dev

Error saving ParseUser or ParseObject on Codenameone using parse4cn1 library

From Dev

name must be a namespace name Visual Studio Error

From Dev

Specify that a Class argument must implement a particular interface

From Dev

WLST: ERROR: You must specify the destination port correctly

From Dev

Getting error: Target class must declare a method with matching name and parameter types

Related Related

  1. 1

    "How to fix 'Error: must either provide a name or specify --generate-name' in Helm"

  2. 2

    Must I specify the parent activity name in the Android Manifest?

  3. 3

    Android error: Path requests must specify a user by using UserEnvironment

  4. 4

    error: name followed by '::' must be a class or namespace name

  5. 5

    Class library with Parse throws error

  6. 6

    ERROR: Need to specify class name in environment or system property LDAP and JNDI

  7. 7

    fatal error class name must be a valid object or a string

  8. 8

    SetReadAccess error for new ParseObject

  9. 9

    Wildfly Maven Plugin error: deploy-artifact must specify the artifactId

  10. 10

    You must register this ParseObject subclass before instantiating it

  11. 11

    Merge r brings error "'by' must specify uniquely valid columns"

  12. 12

    Class cannot be cast to ParseObject

  13. 13

    Error: Must specify a primary resource (JAR or Python file) - Spark scala

  14. 14

    Java - Parse - iterate over ParseObject fields

  15. 15

    Error: JSON Parse error: Property name must be a string literal when using angular translate

  16. 16

    Parse Query not registering class name

  17. 17

    configure: error: cannot guess build type; you must specify one

  18. 18

    ERROR: unbound method "method name" must be called with "Class Name" instance as first argument (got classobj instance instead)

  19. 19

    ERROR: Need to specify class name in environment or system property LDAP and JNDI

  20. 20

    ERROR: Function name must be a string

  21. 21

    fatal error class name must be a valid object or a string

  22. 22

    Class cannot be cast to ParseObject

  23. 23

    configure: error: cannot guess build type; you must specify one

  24. 24

    Encounter code 106 error, when parse class column name is changed

  25. 25

    Error saving ParseUser or ParseObject on Codenameone using parse4cn1 library

  26. 26

    name must be a namespace name Visual Studio Error

  27. 27

    Specify that a Class argument must implement a particular interface

  28. 28

    WLST: ERROR: You must specify the destination port correctly

  29. 29

    Getting error: Target class must declare a method with matching name and parameter types

HotTag

Archive