Ошибка разбора: необходимо указать имя класса ParseObject

У меня проблема, когда я хочу получить ParseObjects из подкласса, содержащего ParseRelation

Когда этот код выполняется:

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!");
    }
}

Я получаю эту ошибку:

Сообщение об ошибке: Необходимо указать имя класса ParseObject при создании ParseQuery. Имя параметра: className

Это часть моего подкласса:

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

Когда пользователь входит в систему, я создаю новый экземпляр User и извлекаю данные следующим образом:

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();
  });
});

Я уже нашел эту страницу: https://www.parse.com/questions/error-when-querying-relational-data-in-unity

Вот трассировка стека, может содержать интересную информацию:

Сообщение об ошибке: Необходимо указать имя класса ParseObject при создании ParseQuery. Имя параметра: className Stack Trace: at Parse.ParseQuery1<Project>..ctor (string) <0x0008f> at Parse.ParseRelationBase.GetQuery<Project> () <0x0004e> at Parse.ParseRelation1.get_Query () <0x00039> at (динамический метод-обертка) Parse.ParseRelation1<Project>.GetProperty (Parse.ParseRelation1 &, Coherent.UI.Binding.Exporter) в 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, пользователь) <0x00145> в Coherent.UI.Binding.Exporter.Export (пользователь) <0x00404> в (динамический метод-обертка) Project.GetProperty (Project&,Coherent.UI.Binding.Exporter) в 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 (динамический метод-оболочка) 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, строка, System.Collections.Generic.List1<Project>) <0x00073> at ProjectsWidget.onProjectsLoaded (System.Collections.Generic.List1) [0x0000c] в

Но я не могу найти ошибку... Кто-нибудь, кто может помочь?

1 ответ

Решение

Сам нашел в конце концов.

Это сочетание проблем между Coherent и Parse. Coherent пытается использовать конструктор по умолчанию ParseRelation, который я использую в классе User в качестве свойства. Но у ParseRelation нет конструктора по умолчанию.

Связный ожидает конструктор по умолчанию. Я изменил следующее:

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

в

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

Удаляя тег CoherentProperty, который мне здесь не нужен, Coherent не хочет экспортировать ParseRelation, поэтому у меня больше нет ошибки конструктора!

Другие вопросы по тегам