One of my fields for PFUser's is "ratingObject", a pointer to another class which has one column: "favouriteNumber". This keeps track of how many users follow this particular user. FavouriteNumber is just a number. I wanted to add this column directly to the PFUser row, however the app was crashing when I tried to increment this value from another user's account. Specifically when calling from user A:
userB.incrementKey("favouriteNumberInPFUser", byValue: 1)
userB.saveInBackground()
So I ended up creating this other class and adding a pointer to PFUser. However I need to perform a PFQuery taking into account this value. If it was in PFUser, no problem. But since it is in this other class, I can't really access it. I tried this:
var query2 = PFUser.query()
query2?.includeKey("ratingObject")
query2!.addDescendingOrder("ratingObject.favouriteNumber")
but it gives this error: [Error]: -ratingObject.favouriteNumber is not a valid order key (Code: 105, Version: 1.7.4)