2015-08-29 9 views
5

Sto sviluppando un'app con Utente e Richiedi come classi su Parse. I miei utenti hanno currentLocation (PFGeoPoint) come attributo e le richieste hanno un puntatore per riferirsi all'utente che possiede la richiesta (richiedente: PFUser). Così Im cercando di trovare le richieste degli utenti in prossimità all'utente corrente loggatoInterrogazione per un attributo puntatore utilizzando Parse

ho bisogno di fare qualcosa di simile:.

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

Ma sfortunatamente questo non è possibile:

[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]) 

Tutte le idee ?

Ecco come il mio Richiesta classe si presenta come il Parse:

enter image description here

Questa è la classe User:

enter image description here

+0

La parte 'dot notation' del messaggio di errore mi porta a credere che il' requestor' di 'whereKey' non sia un oggetto, ovvero che non si possa chiamare currentLocation su un non oggetto (" requestor.currentLocation "). Puoi controllare quello? –

+0

Puoi mostrare anche la classe utente? –

risposta

8

Secondo this question nella Comunità Parse:

Invece del punto n otation in whereKey :, dovresti usare whereKey: matchesKey: inQuery: o whereKey: matchesQuery :.

Problemi correlati