Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Querying for a pointer attribute using Parse

Im developing an app with User and Request as classes on Parse. My Users have currentLocation (PFGeoPoint) as an attribute and Requests have a pointer to refer the User that owns the request (requestor:PFUser). So Im trying to find requests from users near to the current user logged in.

I need to do something like:

let currentUserGeoPoint = PFUser.currentUser()!["currentLocation"] as! PFGeoPoint

var query = PFQuery(className:"Request")
query.whereKey("requestor.currentLocation", nearGeoPoint: currentUserGeoPoint)
query.findObjectsInBackgroundWithBlock {
      (objects, error) -> Void in
          if (error == nil) {
             self.userRequests = objects!
             self.tableView.reloadData()
          }else {
             println(error?.userInfo)
          }
}

But unfortunatelly this is not possible:

[Error]: Dot notation can only be used on objects (Code: 102, Version: 1.8.1)
Optional([code: 102, error: Dot notation can only be used on objects, temporary: 0, NSLocalizedDescription: Dot notation can only be used on objects])

Any ideas?

This is how my Request Class looks like on Parse:

enter image description here

This is the User Class:

enter image description here

like image 474
adolfosrs Avatar asked Aug 29 '15 17:08

adolfosrs


People also ask

How to include a pointer to a post in a query?

For example, a Pointer to a Post could be represented as: When the query is issued with an include parameter for the key holding this pointer, the pointer will be expanded to: You can also do multi level includes using dot notation. If you wanted to include the post for a comment and the post’s author as well you can do:

How to use livequery with parse?

In order to use live queries, you need to set up both of them. The LiveQuery server should work with a Parse Server. The easiest way to setup the LiveQuery server is to make it run with the Parse Server in the same process. When you initialize the Parse Server, you need to define which Parse.Object classes you want to enable LiveQuery like this:

How do I use the Parse-Server-FS-adapter?

To use the FSAdapter, simply initialize your Parse Server in index.js by doing the following: When using parse-server-fs-adapter across multiple Parse Server instances it’s important to establish “centralization” of your file storage (this is the same premise as the other file adapters, you are sending/recieving files through a dedicated link).

What is attribute parser HackerRank solution in C++?

Hello coders, today we are going to solve Attribute Parser HackerRank Solution in C++. This challenge works with a custom-designed markup language HRML. In HRML, each element consists of a starting and ending tag, and there are attributes associated with each tag. Only starting tags can have attributes.


1 Answers

According to this question in the Parse Community:

Instead of dot notation in whereKey:, you would use whereKey:matchesKey:inQuery: or whereKey:matchesQuery:.

like image 182
the_critic Avatar answered Oct 07 '22 02:10

the_critic