3

Im trying to query all elements of subclass in Unity. I have found SDK constraint or missing something here. According to documentation querying subclasses is possible.

> var query = new ParseQuery<Armor>()
    .WhereLessThanOrEqualTo("rupees", ((Player)ParseUser.CurrentUser).Rupees);
query.FindAsync().ContinueWith(t =>
{
    IEnumerable<Armor> result = t.Result;
});

Im however using relation table and cannot specify Here is my code:

IEnumerator LoadMyDesigns(Action<RequestResult> result) {

    ParseUser user = ParseUser.CurrentUser;
    ParseRelation<Design> relation = user.GetRelation<Design>("designs");
    Task<IEnumerable<Design>> task = relation.Query.FindAsync();


    while (!task.IsCompleted) yield return new WaitForEndOfFrame();

    if (task.IsFaulted) {
        //error
        foreach(var e in task.Exception.InnerExceptions) {
            ParseException parseException = (ParseException) e;
            Debug.LogError("Error message " + parseException.Message);
            Debug.LogError("Error code: " + parseException.Code);
            result(new RequestResult(true, parseException.Message));
        }
    }
    else {
        result(new RequestResult(true, new List<Design>(task.Result)));
    }
}

And error:

ArgumentNullException: Must specify a ParseObject class name when creating a ParseQuery.

So the question is how do I specify query subclass type when using relations?

Thanks.

2 Answers 2

1

I've struggled with the same problem and in my case I needed to provide the propertyName again in de GetRelationProperty call.

For example:

[ParseFieldName("designs")]
public ParseRelation<Design> Designs
{
    get { return GetRelationProperty<Design>("Designs"); }
}
Sign up to request clarification or add additional context in comments.

Comments

0

Try querying your designs Table.

Make a new query for class "Designs" where equal("owner", PFUser.currentUser())

This should return all of the designs for the current User.

1 Comment

This is not the issue. I can get the relations data but I cannot specify subclass I want to use. Possibly SDK constraint

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.